AscEmu
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Unit Class Reference

#include <Unit.hpp>

Inheritance diagram for Unit:
[legend]
Collaboration diagram for Unit:
[legend]

Public Member Functions

virtual ~Unit ()
 
void Update (unsigned long time_passed)
 
virtual void RemoveFromWorld (bool free_guid)
 Remove object from world.
 
virtual void OnPushToWorld ()
 
virtual void die (Unit *pAttacker, uint32_t damage, uint32_t spellid)
 
uint64_t getCharmGuid () const
 
void setCharmGuid (uint64_t guid)
 
uint64_t getSummonGuid () const
 
void setSummonGuid (uint64_t guid)
 
uint64_t getCharmedByGuid () const
 
void setCharmedByGuid (uint64_t guid)
 
bool isCharmed () const
 
uint64_t getSummonedByGuid () const
 
void setSummonedByGuid (uint64_t guid)
 
uint64_t getCreatedByGuid () const
 
void setCreatedByGuid (uint64_t guid)
 
uint64_t getTargetGuid () const
 
void setTargetGuid (uint64_t guid)
 
uint64_t getTransGuid ()
 
uint64_t getChannelObjectGuid () const
 
void setChannelObjectGuid (uint64_t guid)
 
uint32_t getChannelSpellId () const
 
void setChannelSpellId (uint32_t spell_id)
 
uint32_t getBytes0 () const
 
void setBytes0 (uint32_t bytes)
 
uint8_t getBytes0ByOffset (uint32_t offset) const
 
void setBytes0ForOffset (uint32_t offset, uint8_t value)
 
uint8_t getRace () const
 
void setRace (uint8_t race)
 
uint32_t getRaceMask () const
 
uint8_t getClass () const
 
void setClass (uint8_t class_)
 
uint32_t getClassMask () const
 
uint8_t getGender () const
 
void setGender (uint8_t gender)
 
PowerType getPowerType () const
 
void setPowerType (uint8_t powerType)
 
uint32_t getHealth () const
 
void setHealth (uint32_t health)
 
void modHealth (int32_t health)
 
void setFullHealth ()
 
void setHealthPct (uint32_t val)
 
uint32_t getPower (PowerType type) const
 
void setPower (PowerType type, uint32_t value, bool sendPacket=true, bool skipObjectUpdate=false)
 
void modPower (PowerType type, int32_t value)
 
uint32_t getMaxHealth () const
 
void setMaxHealth (uint32_t maxHealth)
 
void modMaxHealth (int32_t maxHealth)
 
uint32_t getMaxPower (PowerType type) const
 
void setMaxPower (PowerType type, uint32_t value)
 
void modMaxPower (PowerType type, int32_t value)
 
float getPowerRegeneration (PowerType type) const
 
void setPowerRegeneration (PowerType type, float value)
 
float getPowerRegenerationWhileInterrupted (PowerType type) const
 
void setPowerRegenerationWhileInterrupted (PowerType type, float value)
 
uint32_t getLevel () const
 
void setLevel (uint32_t level)
 
uint32_t getFactionTemplate () const
 
void setFactionTemplate (uint32_t id)
 
void setFaction (uint32_t factionId)
 
uint32_t getVirtualItemSlotId (uint8_t slot) const
 
void setVirtualItemSlotId (uint8_t slot, uint32_t item_id)
 
uint32_t getUnitFlags () const
 
void setUnitFlags (uint32_t unitFlags)
 
void addUnitFlags (uint32_t unitFlags)
 
void removeUnitFlags (uint32_t unitFlags)
 
bool hasUnitFlags (uint32_t unitFlags) const
 
bool isInCombat () const
 
bool isInCombatWith (Unit const *victim) const
 
virtual bool canSwim ()
 
uint32_t getAuraState () const
 
void setAuraState (uint32_t state)
 
void addAuraState (uint32_t state)
 
void removeAuraState (uint32_t state)
 
uint32_t getBaseAttackTime (uint8_t slot) const
 
void setBaseAttackTime (uint8_t slot, uint32_t time)
 
void modBaseAttackTime (uint8_t slot, int32_t modTime)
 
float getBoundingRadius () const
 
void setBoundingRadius (float radius)
 
float getCombatReach () const
 
void setCombatReach (float radius)
 
uint32_t getDisplayId () const
 
void setDisplayId (uint32_t id)
 
void resetDisplayId ()
 
uint32_t getNativeDisplayId () const
 
void setNativeDisplayId (uint32_t id)
 
uint32_t getMountDisplayId () const
 
void setMountDisplayId (uint32_t id)
 
float getMinDamage () const
 
void setMinDamage (float damage)
 
float getMaxDamage () const
 
void setMaxDamage (float damage)
 
float getMinOffhandDamage () const
 
void setMinOffhandDamage (float damage)
 
float getMaxOffhandDamage () const
 
void setMaxOffhandDamage (float damage)
 
uint32_t getBytes1 () const
 
void setBytes1 (uint32_t bytes)
 
uint8_t getBytes1ByOffset (uint32_t offset) const
 
void setBytes1ForOffset (uint32_t offset, uint8_t value)
 
uint8_t getStandState () const
 
void setStandState (uint8_t standState)
 
uint8_t getStandStateFlags () const
 
void setStandStateFlags (uint8_t standStateFlags)
 
void addStandStateFlags (uint8_t standStateFlags)
 
void removeStandStateFlags (uint8_t standStateFlags)
 
uint32_t getPetNumber () const
 
void setPetNumber (uint32_t timestamp)
 
uint32_t getPetNameTimestamp () const
 
void setPetNameTimestamp (uint32_t timestamp)
 
uint32_t getPetExperience () const
 
void setPetExperience (uint32_t experience)
 
uint32_t getPetNextLevelExperience () const
 
void setPetNextLevelExperience (uint32_t experience)
 
float getModCastSpeed () const
 
void setModCastSpeed (float modifier)
 
void modModCastSpeed (float modifier)
 
uint32_t getCreatedBySpellId () const
 
void setCreatedBySpellId (uint32_t id)
 
uint64_t getNpcFlags () const
 
void setNpcFlags (uint64_t npcFlags)
 
void addNpcFlags (uint64_t npcFlags)
 
void removeNpcFlags (uint64_t npcFlags)
 
uint32_t getEmoteState () const
 
void setEmoteState (uint32_t id)
 
uint32_t getStat (uint8_t stat) const
 
void setStat (uint8_t stat, uint32_t value)
 
uint32_t getResistance (uint8_t type) const
 
void setResistance (uint8_t type, uint32_t value)
 
uint32_t getBaseMana () const
 
void setBaseMana (uint32_t baseMana)
 
uint32_t getBaseHealth () const
 
void setBaseHealth (uint32_t baseHealth)
 
uint32_t getBytes2 () const
 
void setBytes2 (uint32_t bytes)
 
uint8_t getBytes2ByOffset (uint32_t offset) const
 
void setBytes2ForOffset (uint32_t offset, uint8_t value)
 
uint8_t getSheathType () const
 
void setSheathType (uint8_t sheathType)
 
uint8_t getPositiveAuraLimit () const
 
void setPositiveAuraLimit (uint8_t limit)
 
uint8_t getPetFlags () const
 
void setPetFlags (uint8_t petFlags)
 
void addPetFlags (uint8_t petFlags)
 
void removePetFlags (uint8_t petFlags)
 
uint8_t getShapeShiftForm () const
 
void setShapeShiftForm (uint8_t shapeShiftForm)
 
uint32_t getShapeShiftMask () const
 
uint32_t getAttackPower () const
 
void setAttackPower (uint32_t value)
 
int32_t getRangedAttackPower () const
 
void setRangedAttackPower (int32_t power)
 
float getMinRangedDamage () const
 
void setMinRangedDamage (float damage)
 
float getMaxRangedDamage () const
 
void setMaxRangedDamage (float damage)
 
uint32_t getPowerCostModifier (uint16_t school) const
 
void setPowerCostModifier (uint16_t school, uint32_t modifier)
 
void modPowerCostModifier (uint16_t school, int32_t modifier)
 
float getPowerCostMultiplier (uint16_t school) const
 
void setPowerCostMultiplier (uint16_t school, float multiplier)
 
void modPowerCostMultiplier (uint16_t school, float multiplier)
 
int32_t getAttackPowerMods () const
 
void setAttackPowerMods (int32_t modifier)
 
void modAttackPowerMods (int32_t modifier)
 
float getAttackPowerMultiplier () const
 
void setAttackPowerMultiplier (float multiplier)
 
void modAttackPowerMultiplier (float multiplier)
 
int32_t getRangedAttackPowerMods () const
 
void setRangedAttackPowerMods (int32_t modifier)
 
void modRangedAttackPowerMods (int32_t modifier)
 
float getRangedAttackPowerMultiplier () const
 
void setRangedAttackPowerMultiplier (float multiplier)
 
void modRangedAttackPowerMultiplier (float multiplier)
 
float getHoverHeight () const
 
void setHoverHeight (float height)
 
void setLocationWithoutUpdate (LocationVector &location)
 
virtual void setPhase (uint8_t command=PHASE_SET, uint32_t newPhase=1)
 
bool isWithinCombatRange (Unit *obj, float dist2compare)
 
bool isWithinMeleeRange (Unit *obj)
 
bool isWithinMeleeRangeAt (LocationVector const &pos, Unit *obj)
 
float getMeleeRange (Unit *target)
 
bool isInInstance () const
 
virtual bool isInWater () const
 
bool isUnderWater () const
 
bool isInAccessiblePlaceFor (Creature *c) const
 
CombatHandlergetCombatHandler ()
 
CombatHandler constgetCombatHandler () const
 
int32_t getCalculatedAttackPower () const
 
int32_t getCalculatedRangedAttackPower () const
 
bool canReachWithAttack (Unit *unitTarget)
 
bool canBeginCombat (Unit *target)
 
virtual void calculateDamage ()
 
MovementInfogetMovementInfo ()
 
uint32_t getUnitMovementFlags () const
 
void setUnitMovementFlags (uint32_t f)
 
void addUnitMovementFlag (uint32_t f)
 
void removeUnitMovementFlag (uint32_t f)
 
bool hasUnitMovementFlag (uint32_t f) const
 
uint16_t getExtraUnitMovementFlags () const
 
void addExtraUnitMovementFlag (uint16_t f2)
 
bool hasExtraUnitMovementFlag (uint16_t f2) const
 
bool isRooted () const
 
bool isMoving () const
 
bool isTurning () const
 
bool IsFlying () const
 
bool IsFalling () const
 
bool isWalking () const
 
bool isHovering () const
 
void setInFront (Object const *target)
 
void setFacingTo (float const ori, bool force=true)
 
void setFacingToObject (Object *object, bool force=true)
 
void setMoveWaterWalk ()
 
void setMoveLandWalk ()
 
void setMoveFeatherFall ()
 
void setMoveNormalFall ()
 
void setMoveHover (bool set_hover)
 
void setMoveCanFly (bool set_fly)
 
void setMoveRoot (bool set_root)
 
void setMoveSwim (bool set_swim)
 
void setMoveDisableGravity (bool disable_gravity)
 
void setMoveWalk (bool set_walk)
 
void setFacing (float newo)
 
void handleFall (MovementInfo const &movementInfo)
 
UnitSpeedInfo constgetSpeedInfo () const
 
float getSpeedRate (UnitSpeedType type, bool current) const
 
void resetCurrentSpeeds ()
 
UnitSpeedType getFastestSpeedType () const
 
void propagateSpeedChange ()
 
void setSpeedRate (UnitSpeedType mtype, float rate, bool current)
 
bool getSpeedDecrease ()
 
void updateSpeed ()
 
void followerAdded (AbstractFollower *f)
 
void followerRemoved (AbstractFollower *f)
 
void removeAllFollowers ()
 
virtual float getFollowAngle () const
 
MovementManagergetMovementManager ()
 
MovementManager constgetMovementManager () const
 
virtual bool canFly ()
 
void stopMoving ()
 
void pauseMovement (uint32_t timer=0, uint8_t slot=0, bool forced=true)
 
void resumeMovement (uint32_t timer=0, uint8_t slot=0)
 
void sendMoveSplinePaket (UnitSpeedType speed_type)
 
void disableSpline ()
 
bool isSplineEnabled () const
 
void jumpTo (float speedXY, float speedZ, bool forward=true, Optional< LocationVector > dest={})
 
void jumpTo (Object *obj, float speedZ, bool withOrientation=false)
 
virtual void handleKnockback (Object *caster, float horizontal, float vertical)
 
virtual MovementGeneratorType getDefaultMovementType () const
 
AIInterfacegetAIInterface () const
 
void setAItoUse (bool value)
 
bool isAIEnabled ()
 
void addUnitStateFlag (uint32_t state_flag)
 
bool hasUnitStateFlag (uint32_t state_flag) const
 
void removeUnitStateFlag (uint32_t state_flag)
 
uint32_t getUnitStateFlags ()
 
bool isInEvadeMode () const
 
void setControlled (bool apply, UnitStates state)
 
void applyControlStatesIfNeeded ()
 
void playSpellVisual (uint32_t visual_id, uint32_t type)
 
void applyDiminishingReturnTimer (uint32_t *duration, SpellInfo const *spell)
 
void removeDiminishingReturnTimer (SpellInfo const *spell)
 
bool canDualWield () const
 
void setDualWield (bool enable)
 
SpellCastResult castSpell (uint64_t targetGuid, uint32_t spellId, bool triggered=false)
 
SpellCastResult castSpell (Unit *target, uint32_t spellId, bool triggered=false)
 
SpellCastResult castSpell (uint64_t targetGuid, SpellInfo const *spellInfo, bool triggered=false)
 
SpellCastResult castSpell (Unit *target, SpellInfo const *spellInfo, bool triggered=false)
 
SpellCastResult castSpell (uint64_t targetGuid, uint32_t spellId, SpellForcedBasePoints forcedBasepoints, bool triggered=false)
 
SpellCastResult castSpell (Unit *target, uint32_t spellId, SpellForcedBasePoints forcedBasePoints, bool triggered=false)
 
SpellCastResult castSpell (Unit *target, SpellInfo const *spellInfo, SpellForcedBasePoints forcedBasePoints, int32_t spellCharges, bool triggered=false)
 
SpellCastResult castSpell (SpellCastTargets targets, uint32_t spellId, bool triggered=false)
 
SpellCastResult castSpell (SpellCastTargets targets, SpellInfo const *spellInfo, bool triggered=false)
 
SpellCastResult castSpellLoc (const LocationVector location, uint32_t spellId, bool triggered=false)
 
SpellCastResult castSpellLoc (const LocationVector location, SpellInfo const *spellInfo, bool triggered=false)
 
void eventCastSpell (Unit *target, SpellInfo const *spellInfo)
 
SpellCastResult castSpell (uint64_t targetGuid, SpellInfo const *spellInfo, SpellForcedBasePoints forcedBasepoints, bool triggered)
 
SpellCastResult castSpell (Unit *target, SpellInfo const *spellInfo, SpellForcedBasePoints forcedBasepoints, bool triggered)
 
SpellProcaddProcTriggerSpell (uint32_t spellId, uint32_t originalSpellId, uint64_t casterGuid, uint32_t procChance, SpellProcFlags procFlags, SpellExtraProcFlags exProcFlags, uint32_t const *spellFamilyMask, uint32_t const *procClassMask=nullptr, Aura *createdByAura=nullptr, Object *obj=nullptr)
 
SpellProcaddProcTriggerSpell (SpellInfo const *spellInfo, uint64_t casterGuid, Aura *createdByAura=nullptr, uint32_t const *procClassMask=nullptr, Object *obj=nullptr)
 
SpellProcaddProcTriggerSpell (SpellInfo const *spellInfo, Aura *createdByAura, uint64_t casterGuid, uint32_t const *procClassMask=nullptr, Object *obj=nullptr)
 
SpellProcaddProcTriggerSpell (SpellInfo const *spellInfo, SpellInfo const *originalSpellInfo, uint64_t casterGuid, uint32_t procChance, uint32_t procFlags, uint32_t const *procClassMask=nullptr, Aura *createdByAura=nullptr, Object *obj=nullptr)
 
SpellProcaddProcTriggerSpell (SpellInfo const *spellInfo, SpellInfo const *originalSpellInfo, uint64_t casterGuid, uint32_t procChance, SpellProcFlags procFlags, SpellExtraProcFlags exProcFlags, uint32_t const *spellFamilyMask, uint32_t const *procClassMask=nullptr, Aura *createdByAura=nullptr, Object *obj=nullptr)
 
SpellProcgetProcTriggerSpell (uint32_t spellId, uint64_t casterGuid) const
 
void removeProcTriggerSpell (uint32_t spellId, uint64_t casterGuid=0, uint64_t misc=0)
 
void clearProcCooldowns ()
 
float_t applySpellDamageBonus (SpellInfo const *spellInfo, int32_t baseDmg, float_t effectPctModifier=1.0f, bool isPeriodic=false, Spell *castingSpell=nullptr, Aura *aur=nullptr)
 
float_t applySpellHealingBonus (SpellInfo const *spellInfo, int32_t baseHeal, float_t effectPctModifier=1.0f, bool isPeriodic=false, Spell *castingSpell=nullptr, Aura *aur=nullptr)
 
float_t getCriticalChanceForDamageSpell (Spell *spell, Aura *aura, Unit *target)
 
float_t getCriticalChanceForHealSpell (Spell *spell, Aura *aura, Unit *target)
 
bool isCriticalDamageForSpell (Object *target, Spell *spell)
 
bool isCriticalHealForSpell (Object *target, Spell *spell)
 
float_t getCriticalDamageBonusForSpell (float_t damage, Unit *target, Spell *spell, Aura *aura)
 
float_t getCriticalHealBonusForSpell (float_t heal, Spell *spell, Aura *aura)
 
void sendSpellNonMeleeDamageLog (Object *caster, Object *target, SpellInfo const *spellInfo, uint32_t damage, uint32_t absorbedDamage, uint32_t resistedDamage, uint32_t blockedDamage, uint32_t overKill, bool isPeriodicDamage, bool isCriticalHit)
 
void sendSpellHealLog (Object *caster, Object *target, uint32_t spellId, uint32_t healAmount, bool isCritical, uint32_t overHeal, uint32_t absorbedHeal)
 
void sendSpellOrDamageImmune (uint64_t casterGuid, Unit *target, uint32_t spellId)
 
void sendAttackerStateUpdate (const WoWGuid &attackerGuid, const WoWGuid &victimGuid, HitStatus hitStatus, uint32_t damage, uint32_t overKill, DamageInfo damageInfo, uint32_t absorbedDamage, VisualState visualState, uint32_t blockedDamage, uint32_t rageGain)
 
void addSpellModifier (AuraEffectModifier const *aurEff, bool apply)
 
template<typename T >
void applySpellModifiers (SpellModifierType modType, T *value, SpellInfo const *spellInfo, Spell *castingSpell=nullptr, Aura *castingAura=nullptr)
 
template<typename T >
void getTotalSpellModifiers (SpellModifierType modType, T baseValue, int32_t *flatMod, int32_t *pctMod, SpellInfo const *spellInfo, Spell *castingSpell=nullptr, Aura *castingAura=nullptr, bool checkOnly=false)
 
void addSpellImmunity (SpellImmunityMask immunityMask, bool apply)
 
uint32_t getSpellImmunity () const
 
bool hasSpellImmunity (SpellImmunityMask immunityMask) const
 
void addAura (std::unique_ptr< Aura > aur)
 
uint8_t findVisualSlotForAura (Aura const *aur) const
 
AuragetAuraWithId (uint32_t spell_id) const
 
AuragetAuraWithId (uint32_t const *auraId) const
 
AuragetAuraWithIdForGuid (uint32_t const *auraId, uint64_t guid) const
 
AuragetAuraWithIdForGuid (uint32_t spell_id, uint64_t guid) const
 
AuragetAuraWithAuraEffect (AuraEffect aura_effect) const
 
AuragetAuraWithAuraEffectForGuid (AuraEffect aura_effect, uint64_t guid) const
 
AuragetAuraWithVisualSlot (uint8_t visualSlot) const
 
AuragetAuraWithAuraSlot (uint16_t auraSlot) const
 
int32_t getTotalIntDamageForAuraEffect (AuraEffect aura_effect) const
 
int32_t getTotalIntDamageForAuraEffectByMiscValue (AuraEffect aura_effect, int32_t miscValue) const
 
float_t getTotalFloatDamageForAuraEffect (AuraEffect aura_effect) const
 
float_t getTotalFloatDamageForAuraEffectByMiscValue (AuraEffect aura_effect, int32_t miscValue) const
 
float_t getTotalPctMultiplierForAuraEffect (AuraEffect aura_effect) const
 
float_t getTotalPctMultiplierForAuraEffectByMiscValue (AuraEffect aura_effect, int32_t miscValue) const
 
bool hasAurasWithId (uint32_t auraId) const
 
bool hasAurasWithId (uint32_t const *auraId) const
 
bool hasAurasWithIdForGuid (uint32_t auraId, uint64_t guid) const
 
bool hasAurasWithIdForGuid (uint32_t const *auraId, uint64_t guid) const
 
bool hasAuraWithAuraEffect (AuraEffect type) const
 
bool hasAuraWithAuraEffectForGuid (AuraEffect type, uint64_t guid) const
 
bool hasAuraWithMechanic (SpellMechanic mechanic) const
 
bool hasAuraWithSpellType (SpellTypes type, uint64_t casterGuid=0, uint32_t skipSpellId=0) const
 
bool hasAuraState (AuraState state, SpellInfo const *spellInfo=nullptr, Unit const *caster=nullptr) const
 
void addAuraStateAndAuras (AuraState state)
 
void removeAuraStateAndAuras (AuraState state)
 
uint32_t getAuraCountForId (uint32_t auraId) const
 
uint32_t getAuraCountForEffect (AuraEffect aura_effect) const
 
uint32_t getAuraCountWithDispelType (DispelType type, uint64_t casterGuid=0) const
 
void removeAllAuras ()
 
void removeAllAurasById (uint32_t auraId, AuraRemoveMode mode=AURA_REMOVE_BY_SERVER)
 
void removeAllAurasById (uint32_t const *auraId, AuraRemoveMode mode=AURA_REMOVE_BY_SERVER)
 
void eventRemoveAura (uint32_t spellId)
 
void removeAllAurasByIdForGuid (uint32_t auraId, uint64_t guid, AuraRemoveMode mode=AURA_REMOVE_BY_SERVER)
 
void removeAllAurasByAuraInterruptFlag (uint32_t auraInterruptFlag, uint32_t skipSpellId=0)
 
void removeAllAurasByAuraEffect (AuraEffect effect, uint32_t skipSpell=0, bool removeOnlyEffect=false, uint64_t casterGuid=0, AuraRemoveMode mode=AURA_REMOVE_BY_SERVER)
 
void removeAllAurasBySpellMechanic (SpellMechanic mechanic, bool negativeOnly=true)
 
void removeAllAurasBySpellMechanic (SpellMechanic const *mechanic, bool negativeOnly=true)
 
void removeAllAurasBySpellType (SpellTypes type, uint64_t casterGuid=0, uint32_t skipSpellId=0)
 
void removeAllAurasBySchoolMask (SchoolMask schoolMask, bool negativeOnly=true, bool isImmune=false)
 
void removeAllNegativeAuras ()
 
void removeAllPositiveAuras ()
 
void removeAllNonPersistentAuras ()
 
void removeAuraByItemGuid (uint32_t auraId, uint64_t itemguid)
 
uint32_t removeAllAurasByIdReturnCount (uint32_t auraId, AuraRemoveMode mode=AURA_REMOVE_BY_SERVER)
 
uint64_t getSingleTargetGuidForAura (uint32_t spellId)
 
uint64_t getSingleTargetGuidForAura (uint32_t const *spellIds, uint32_t *index)
 
void setSingleTargetGuidForAura (uint32_t spellId, uint64_t guid)
 
void removeSingleTargetGuidForAura (uint32_t spellId)
 
void clearAllAreaAuraTargets ()
 
void removeAllAreaAurasCastedByOther ()
 
uint32_t getTransformAura () const
 
void setTransformAura (uint32_t auraId)
 
void sendAuraUpdate (Aura *aur, bool remove)
 
void sendFullAuraUpdate ()
 
bool sendPeriodicAuraLog (const WoWGuid &casterGuid, const WoWGuid &targetGuid, SpellInfo const *spellInfo, uint32_t amount, uint32_t overKillOrOverHeal, uint32_t absorbed, uint32_t resisted, AuraEffect auraEffect, bool isCritical, uint32_t miscValue=0, float gainMultiplier=0.0f)
 
AuraArray constgetAuraList () const
 
AuraEffectList constgetAuraEffectList (AuraEffect effect) const
 
VisualAuraArray constgetVisualAuraList () const
 
bool isPoisoned ()
 
bool isDazed () const
 
bool canSee (Object *const obj)
 
int32_t getStealthLevel (StealthFlag flag) const
 
int32_t getStealthDetection (StealthFlag flag) const
 
void modStealthLevel (StealthFlag flag, const int32_t amount)
 
void modStealthDetection (StealthFlag flag, const int32_t amount)
 
bool isStealthed () const
 
int32_t getInvisibilityLevel (InvisibilityFlag flag) const
 
int32_t getInvisibilityDetection (InvisibilityFlag flag) const
 
void modInvisibilityLevel (InvisibilityFlag flag, const int32_t amount)
 
void modInvisibilityDetection (InvisibilityFlag flag, const int32_t amount)
 
bool isInvisible () const
 
void setVisible (const bool visible)
 
void updateVisibility ()
 
void regenerateHealthAndPowers (uint16_t timePassed)
 
void regeneratePower (PowerType type, uint16_t timePassed)
 
void interruptHealthRegeneration (uint32_t timeInMS)
 
bool isHealthRegenerationInterrupted () const
 
void energize (Unit *target, uint32_t spellId, uint32_t amount, PowerType type, bool sendPacket=true)
 
void sendSpellEnergizeLog (Unit *target, uint32_t spellId, uint32_t amount, PowerType type)
 
uint8_t getHealthPct () const
 
uint8_t getPctFromMaxHealth (uint8_t pct) const
 
uint8_t getPowerPct (PowerType powerType) const
 
void sendPowerUpdate (bool self)
 
void updateEnergyRegeneration (bool initialUpdate=false)
 
void updateFocusRegeneration (bool initialUpdate=false)
 
std::unique_ptr< WorldPacketcreateChatPacket (uint8_t type, uint32_t language, std::string msg, Unit *receiver=nullptr, uint32_t sessionLanguage=0)
 
void sendChatMessage (uint8_t type, uint32_t language, std::string msg, Unit *receiver=nullptr, uint32_t sessionLanguage=0)
 
void sendChatMessage (uint8_t type, uint32_t language, std::string msg, uint32_t delay)
 
void sendChatMessage (MySQLStructure::NpcScriptText const *text, uint32_t delay, Unit *target=nullptr)
 
void sendChatMessageToPlayer (uint8_t type, uint32_t language, std::string msg, Player *plr)
 
void sendChatMessageAlternateEntry (uint32_t entry, uint8_t type, uint32_t lang, std::string msg)
 
void setAttackTimer (WeaponDamageType type, uint32_t time)
 
uint32_t getAttackTimer (WeaponDamageType type) const
 
bool isAttackReady (WeaponDamageType type) const
 
void resetAttackTimer (WeaponDamageType type)
 
void modAttackSpeedModifier (WeaponDamageType type, int32_t amount)
 
float getAttackSpeedModifier (WeaponDamageType type) const
 
void sendEnvironmentalDamageLogPacket (uint64_t guid, uint8_t type, uint32_t damage, uint64_t unk=0)
 
virtual bool isPvpFlagSet () const
 
virtual void setPvpFlag ()
 
virtual void removePvpFlag ()
 
virtual bool isFfaPvpFlagSet () const
 
virtual void setFfaPvpFlag ()
 
virtual void removeFfaPvpFlag ()
 
virtual bool isSanctuaryFlagSet () const
 
virtual void setSanctuaryFlag ()
 
virtual void removeSanctuaryFlag ()
 
void restoreDisplayId ()
 
bool isSitting () const
 
void emote (EmoteType emote)
 
void eventAddEmote (EmoteType emote, uint32_t time)
 
void emoteExpire ()
 
uint32_t getOldEmote () const
 
void dealDamage (Unit *victim, uint32_t damage, uint32_t spellId, bool removeAuras=true)
 
void takeDamage (Unit *attacker, uint32_t damage, uint32_t spellId)
 
void addSimpleDamageBatchEvent (uint32_t damage, Unit *attacker=nullptr, SpellInfo const *spellInfo=nullptr)
 
void addSimpleEnvironmentalDamageBatchEvent (EnviromentalDamage type, uint32_t damage, uint32_t absorbedDamage=0)
 
void addSimpleHealingBatchEvent (uint32_t heal, Unit *healer=nullptr, SpellInfo const *spellInfo=nullptr)
 
void addHealthBatchEvent (std::unique_ptr< HealthBatchEvent > batch)
 
uint32_t calculateEstimatedOverKillForCombatLog (uint32_t damage) const
 
uint32_t calculateEstimatedOverHealForCombatLog (uint32_t heal) const
 
void clearHealthBatch ()
 
void clearCasterFromHealthBatch (Unit const *caster)
 
uint32_t absorbDamage (SchoolMask schoolMask, uint32_t *dmg, bool checkOnly=true)
 
void smsg_AttackStart (Unit *pVictim)
 
void smsg_AttackStop (Unit *pVictim)
 
virtual void addToInRangeObjects (Object *pObj)
 
virtual void onRemoveInRangeObject (Object *pObj)
 
void clearInRangeSets ()
 
bool setDetectRangeMod (uint64_t guid, int32_t amount)
 
void unsetDetectRangeMod (uint64_t guid)
 
int32_t getDetectRangeMod (uint64_t guid) const
 
virtual bool isCritter ()
 
void knockbackFrom (float x, float y, float speedXY, float speedZ)
 
virtual bool isTrainingDummy ()
 
GameObjectgetGameObject (uint32_t spellId) const
 
void addGameObject (GameObject *gameObj)
 
void removeGameObject (GameObject *gameObj, bool del)
 
void removeGameObject (uint32_t spellId, bool del)
 
void removeAllGameObjects ()
 
void deMorph ()
 
bool isAlive () const
 
bool justDied () const
 
bool isDead () const
 
virtual void setDeathState (DeathState state)
 
DeathState getDeathState () const
 
PetgetPet () const
 
TotemSummongetTotem (SummonSlot slot) const
 
SummonHandlergetSummonInterface ()
 
SummonHandler constgetSummonInterface () const
 
void handleSpellClick (Unit *clicker)
 
bool isMounted () const
 
void mount (uint32_t mount, uint32_t vehicleId=0, uint32_t creatureEntry=0)
 
void dismount (bool resummonPet=true)
 
bool isUnitOwnerInParty (Unit *unit)
 
bool isUnitOwnerInRaid (Unit *unit)
 
ThreatManagergetThreatManager ()
 
ThreatManager constgetThreatManager () const
 
void clearHateList ()
 
void wipeHateList ()
 
void wipeTargetList ()
 
int32_t getThreatModifyer ()
 
void modThreatModifyer (int32_t mod)
 
int32_t getGeneratedThreatModifyer (uint32_t school)
 
void modGeneratedThreatModifyer (uint32_t school, int32_t mod)
 
void setTaggerGuid (Unit const *tagger)
 
uint64_t getTaggerGuid () const
 
bool isTagged () const
 
bool isTaggableFor (Unit const *unit) const
 
bool isTaggedByPlayerOrItsGroup (Player *tagger)
 
bool isLootable ()
 
void buildMovementPacket (ByteBuffer *data)
 
void buildMovementPacket (ByteBuffer *data, float x, float y, float z, float o)
 
void possess (Unit *unitTarget, uint32_t delay=0)
 
void unPossess ()
 
uint16_t hasNoInterrupt () const
 
void removeGarbage ()
 
void addGarbageAura (std::unique_ptr< Aura > aur)
 
void addGarbagePet (Pet *pet)
 
virtual void deactivate (WorldMap *mgr)
 
float getChanceToDaze (Unit *target)
 
void eventModelChange ()
 
void aggroPvPGuards ()
 
void setTriggerStunOrImmobilize (uint32_t newTrigger, uint32_t newChance, bool isVictim=false)
 
void eventStunOrImmobilize (Unit *unitProcTarget, bool isVictim=false)
 
void setTriggerChill (uint32_t newTrigger, uint32_t newChance, bool isVictim=false)
 
void eventChill (Unit *unitProcTarget, bool isVictim=false)
 
void removeExtraStrikeTarget (SpellInfo const *spellInfo)
 
void addExtraStrikeTarget (SpellInfo const *spellInfo, uint32_t charges)
 
uint32_t doDamageSplitTarget (uint32_t res, SchoolMask schoolMask, bool isMeleeDmg)
 
void removeReflect (uint32_t spellId, bool apply)
 
void castOnMeleeSpell ()
 
uint64_t getAuraUpdateMaskForRaid () const
 
void resetAuraUpdateMaskForRaid ()
 
void setAuraUpdateMaskForRaid (uint8_t slot)
 
void updateAuraForGroup (uint8_t slot)
 
void giveGroupXP (Unit *unitVictim, Player *playerInGroup)
 
void calculateResistanceReduction (Unit *unitVictim, DamageInfo *damageInfo, SpellInfo const *spellInfoAbility, float armorPctReduce)
 
bool removeAurasByHeal ()
 
bool auraActionIf (AuraAction *auraAction, AuraCondition *auraCondition)
 
uint32_t getManaShieldAbsorbedDamage (uint32_t damage)
 
AuraCheckResponse auraCheck (SpellInfo const *spellInfo, Object *caster=nullptr)
 
AuraCheckResponse auraCheck (SpellInfo const *spellInfo, Aura *aura, Object *caster=nullptr)
 
uint32_t getSpellDidHitResult (Unit *pVictim, uint32_t weapon_damage_type, Spell *castingSpell)
 Combat.
 
DamageInfo strike (Unit *pVictim, WeaponDamageType weaponType, SpellInfo const *ability, int32_t add_damage, int32_t pct_dmg_mod, uint32_t exclusive_damage, bool disable_proc, bool skip_hit_check, bool force_crit=false, Spell *castingSpell=nullptr)
 
uint32_t handleProc (uint32_t flag, Unit *Victim, SpellInfo const *CastingSpell, DamageInfo damageInfo, bool isSpellTriggered, ProcEvents procEvent=PROC_EVENT_DO_ALL, Aura *triggeredFromAura=nullptr)
 
void handleProcDmgShield (uint32_t flag, Unit *attacker)
 
WDB::Structures::MountCapabilityEntry constgetMountCapability (uint32_t mountType)
 
void setOnMeleeSpell (uint32_t spellId, uint8_t ecn=0)
 
uint32_t getOnMeleeSpell () const
 
uint8_t getOnMeleeSpellEcn () const
 
void setHitFromMeleeSpell (float value)
 
float getHitFromMeleeSpell ()
 
uint32_t isPacified () const
 
uint32_t isStunned () const
 
uint32_t isFeared () const
 
uint32_t getResistChanceMod () const
 
void setResistChanceMod (uint32_t amount)
 
virtual int32_t GetDamageDoneMod (uint16_t)
 
virtual float GetDamageDonePctMod (uint16_t)
 
void setcanparry (bool newstatus)
 
uint32_t getCharmTempVal () const
 
void setCharmTempVal (uint32_t val)
 
void setDiminishTimer (uint32_t index)
 
float getModelHalfSize () const
 
float getCollisionHeight () const override
 
float getBlockFromSpell () const
 
float getParryFromSpell () const
 
float getDodgeFromSpell () const
 
void setBlockFromSpell (float value)
 
void setParryFromSpell (float value)
 
void setDodgeFromSpell (float value)
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
void Update (unsigned long)
 
virtual void AddToWorld ()
 
virtual void AddToWorld (WorldMap *pMapMgr)
 
void PushToWorld (WorldMap *)
 
bool IsInWorld () const
 
virtual void OnPrePushToWorld ()
 
virtual void OnPreRemoveFromWorld ()
 
virtual void OnRemoveFromWorld ()
 
bool write (const uint8_t &member, uint8_t val, bool skipObjectUpdate=false)
 
bool write (const uint16_t &member, uint16_t val, bool skipObjectUpdate=false)
 
bool write (const float &member, float val, bool skipObjectUpdate=false)
 
bool write (const int32_t &member, int32_t val, bool skipObjectUpdate=false)
 
bool write (const uint32_t &member, uint32_t val, bool skipObjectUpdate=false)
 
bool write (const uint64_t &member, uint64_t val, bool skipObjectUpdate=false)
 
bool write (const uint64_t &member, uint32_t low, uint32_t high, bool skipObjectUpdate=false)
 
bool writeLow (const uint64_t &member, uint32_t val, bool skipObjectUpdate=false)
 
bool writeHigh (const uint64_t &member, uint32_t val, bool skipObjectUpdate=false)
 
uint64_t getGuid () const
 
void setGuid (uint64_t guid)
 
void setGuid (uint32_t low, uint32_t high)
 
uint32_t getGuidLow () const
 
void setGuidLow (uint32_t low)
 
uint32_t getGuidHigh () const
 
void setGuidHigh (uint32_t high)
 
uint16_t getOType () const
 
void setOType (uint16_t type)
 
void setObjectType (uint8_t objectTypeId)
 
void setEntry (uint32_t entry)
 
uint32_t getEntry () const
 
uint16_t getDynamicFlags () const
 
int16_t getDynamicPathProgress () const
 
void setDynamicFlags (uint16_t dynamicFlags)
 
void addDynamicFlags (uint16_t dynamicFlags)
 
void removeDynamicFlags (uint16_t dynamicFlags)
 
bool hasDynamicFlags (uint16_t dynamicFlags) const
 
void setDynamicPathProgress (int16_t pathProgress)
 
float getScale () const
 
void setScale (float scaleX)
 
void updateObject ()
 
virtual uint32_t buildCreateUpdateBlockForPlayer (ByteBuffer *data, Player *target)
 This includes any nested objects we have, inventory for example.
 
void forceBuildUpdateValueForField (uint32_t field, Player *target)
 
void forceBuildUpdateValueForFields (uint32_t const *fields, Player *target)
 
uint8_t getObjectTypeId () const
 
bool isCreatureOrPlayer () const
 
bool isPlayer () const
 
bool isCreature () const
 
bool isItem () const
 
bool isGameObject () const
 
bool isCorpse () const
 
bool isContainer () const
 
virtual bool isPet () const
 
virtual bool isTotem () const
 
virtual bool isSummon () const
 
virtual bool isVehicle () const
 
virtual bool isTransporter () const
 
bool isInRange (LocationVector location, float square_r) const
 
bool isInRange (float x, float y, float z, float square_r) const
 
float getDistanceSq (LocationVector target) const
 
float getDistanceSq (float x, float y, float z) const
 
SpellgetCurrentSpell (CurrentSpellType spellType) const
 
SpellgetCurrentSpellById (uint32_t spellId) const
 
void setCurrentSpell (Spell *curSpell)
 
void interruptSpell (uint32_t spellId=0, bool checkMeleeSpell=true)
 
void interruptSpellWithSpellType (CurrentSpellType spellType)
 
bool isCastingSpell (bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false) const
 
SpellfindCurrentCastedSpellBySpellId (uint32_t spellId)
 
DamageInfo doSpellDamage (Unit *victim, uint32_t spellId, float_t damage, uint8_t effIndex, bool isTriggered=false, bool isPeriodic=false, bool isLeech=false, bool forceCrit=false, Spell *spell=nullptr, Aura *aur=nullptr, AuraEffectModifier *aurEff=nullptr)
 
DamageInfo doSpellHealing (Unit *victim, uint32_t spellId, float_t heal, bool isTriggered=false, bool isPeriodic=false, bool isLeech=false, bool forceCrit=false, Spell *spell=nullptr, Aura *aur=nullptr, AuraEffectModifier *aurEff=nullptr)
 
void _UpdateSpells (uint32_t time)
 
void addTravelingSpell (Spell *spell)
 
void removeTravelingSpell (Spell *spell)
 
void addGarbageSpell (Spell *spell)
 
void removeGarbageSpells ()
 
void removeSpellModifierFromCurrentSpells (AuraEffectModifier const *aur)
 
void removeSelfFromInrangeSets ()
 
std::vector< Object * > getInRangeObjectsSet () const
 
bool hasInRangeObjects () const
 
size_t getInRangeObjectsCount () const
 
bool isObjectInInRangeObjectsSet (Object *pObj) const
 
void removeObjectFromInRangeObjectsSet (Object *pObj)
 
std::vector< Object * > getInRangePlayersSet () const
 
size_t getInRangePlayersCount () const
 
std::vector< Object * > getInRangeOppositeFactionSet () const
 
bool isObjectInInRangeOppositeFactionSet (Object *pObj) const
 
void updateInRangeOppositeFactionSet ()
 
void addInRangeOppositeFaction (Object *obj)
 
void removeObjectFromInRangeOppositeFactionSet (Object *obj)
 
std::vector< Object * > getInRangeSameFactionSet () const
 
bool isObjectInInRangeSameFactionSet (Object *pObj) const
 
void updateInRangeSameFactionSet ()
 
void addInRangeSameFaction (Object *obj)
 
void removeObjectFromInRangeSameFactionSet (Object *obj)
 
virtual UnitgetUnitOwner ()
 
virtual Unit constgetUnitOwner () const
 
virtual UnitgetUnitOwnerOrSelf ()
 
virtual Unit constgetUnitOwnerOrSelf () const
 
virtual PlayergetPlayerOwner ()
 
virtual Player constgetPlayerOwner () const
 
virtual PlayergetPlayerOwnerOrSelf ()
 
virtual Player constgetPlayerOwnerOrSelf () const
 
void sendGameobjectDespawnAnim ()
 
const WoWGuidGetNewGUID () const
 
uint32_t GetTypeFromGUID () const
 
uint32_t GetUIdFromGUID () const
 
bool IsType (TYPE type_mask) const
 
uint32_t BuildValuesUpdateBlockForPlayer (ByteBuffer *buf, Player *target)
 
uint32_t BuildValuesUpdateBlockForPlayer (ByteBuffer *buf, UpdateMask *mask)
 
void BuildFieldUpdatePacket (Player *Target, uint32_t Index, uint32_t Value)
 
void BuildFieldUpdatePacket (ByteBuffer *buf, uint32_t Index, uint32_t Value)
 
void updatePositionData ()
 
bool SetPosition (float newX, float newY, float newZ, float newOrientation, bool allowPorting=false)
 
bool SetPosition (const LocationVector &v, bool allowPorting=false)
 
const float & GetPositionX () const
 
const float & GetPositionY () const
 
const float & GetPositionZ () const
 
const float & GetOrientation () const
 
void SetOrientation (float o)
 
void SetSpawnLocation (float newX, float newY, float newZ, float newOrientation)
 
void SetSpawnLocation (LocationVector loc)
 
const float & GetSpawnX () const
 
const float & GetSpawnY () const
 
const float & GetSpawnZ () const
 
const float & GetSpawnO () const
 
LocationVector GetSpawnPosition () const
 
::WDB::Structures::AreaTableEntry constGetArea () const
 
void getPosition (float &x, float &y) const
 
void getPosition (float &x, float &y, float &z) const
 
void getPosition (float &x, float &y, float &z, float &o) const
 
LocationVector GetPosition () const
 
LocationVectorGetPositionNC ()
 
LocationVectorGetPositionV ()
 
void SetTransport (Transporter *t)
 
TransporterGetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
uint32_t GetTransTime () const
 
PlayerToPlayer ()
 
Player constToPlayer () const
 
CreatureToCreature ()
 
Creature constToCreature () const
 
SummonToSummon ()
 
Summon constToSummon () const
 
UnitToUnit ()
 
Unit constToUnit () const
 
GameObjectToGameObject ()
 
GameObject constToGameObject () const
 
float getExactDist2dSq (const float x, const float y) const
 
float getExactDist2dSq (LocationVector const &pos) const
 
float getExactDist2dSq (LocationVector const *pos) const
 
float getExactDist2d (const float x, const float y) const
 
float getExactDist2d (LocationVector const &pos) const
 
float getExactDist2d (LocationVector const *pos) const
 
float getExactDistSq (float x, float y, float z) const
 
float getExactDistSq (LocationVector const &pos) const
 
float getExactDistSq (LocationVector const *pos) const
 
float getExactDist (float x, float y, float z) const
 
float getExactDist (LocationVector const &pos) const
 
float getExactDist (LocationVector const *pos) const
 
float getDistance (Object const *obj) const
 
float getDistance (LocationVector const &pos) const
 
float getDistance (float x, float y, float z) const
 
float getDistance2d (Object const *obj) const
 
float getDistance2d (float x, float y) const
 
float getDistanceZ (Object const *obj) const
 
float CalcDistance (Object *Ob)
 
float CalcDistance (float ObX, float ObY, float ObZ)
 
float CalcDistance (Object *Oa, Object *Ob)
 
float CalcDistance (Object *Oa, float ObX, float ObY, float ObZ)
 
float CalcDistance (float OaX, float OaY, float OaZ, float ObX, float ObY, float ObZ)
 
bool IsInMap (Object *obj)
 
bool IsWithinDistInMap (Object *obj, const float dist2compare) const
 
bool IsWithinLOSInMap (Object *obj)
 
bool IsWithinLOS (LocationVector location)
 
MapCellGetMapCell () const
 
uint32_t GetMapCellX ()
 
uint32_t GetMapCellY ()
 
void SetMapCell (MapCell *cell)
 
WorldMapgetWorldMap () const
 
ObjectgetWorldMapObject (const uint64_t &guid) const
 
PetgetWorldMapPet (const uint64_t &guid) const
 
UnitgetWorldMapUnit (const uint64_t &guid) const
 
PlayergetWorldMapPlayer (const uint64_t &guid) const
 
CreaturegetWorldMapCreature (const uint64_t &guid) const
 
GameObjectgetWorldMapGameObject (const uint64_t &guid) const
 
DynamicObjectgetWorldMapDynamicObject (const uint64_t &guid) const
 
void SetMapId (uint32_t newMap)
 
void setZoneId (uint32_t newZone)
 
void setAreaId (uint32_t area)
 
uint32_t GetMapId () const
 
const uint32_tgetZoneId () const
 
const uint32_tgetAreaId () const
 
bool isOutdoors () const
 
ZLiquidStatus getLiquidStatus () const
 
void SetNewGuid (uint32_t Guid)
 
void ClearUpdateMask ()
 
bool HasUpdateField (uint32_t index)
 
bool isInRange (Object *target, float range)
 
bool isInFront (Object *target)
 
bool isInBack (Object *target)
 
bool isInArc (Object *target, float degrees)
 
bool HasInArc (float degrees, Object *target)
 
float calcAngle (float Position1X, float Position1Y, float Position2X, float Position2Y)
 
float calcRadAngle (float Position1X, float Position1Y, float Position2X, float Position2Y)
 
float getEasyAngle (float angle)
 
float getAbsoluteAngle (float x, float y) const
 
float getAbsoluteAngle (LocationVector const &pos)
 
float getAbsoluteAngle (Object const *obj)
 
float getAbsoluteAngle (LocationVector const *pos) const
 
float toAbsoluteAngle (float relAngle) const
 
float toRelativeAngle (float absAngle) const
 
float getRelativeAngle (Object const *obj)
 
float getRelativeAngle (float x, float y) const
 
float getRelativeAngle (LocationVector const &pos) const
 
float getRelativeAngle (LocationVector const *pos) const
 
bool isInDist2d (LocationVector const &pos, float dist) const
 
bool isInDist (Object *pos, float dist)
 
bool isInDist (LocationVector const &pos, float dist)
 
void getNearPoint2D (Object *searcher, float &x, float &y, float distance, float absAngle)
 
void getNearPoint (Object *searcher, float &x, float &y, float &z, float distance2d, float absAngle)
 
void getClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0)
 
LocationVector getHitSpherePointFor (LocationVector const &dest)
 
void getHitSpherePointFor (LocationVector const &dest, float &x, float &y, float &z) const
 
LocationVector getHitSpherePointFor (LocationVector const &dest) const
 
void updateGroundPositionZ (float x, float y, float &z)
 
void updateAllowedPositionZ (float x, float y, float &z, float *groundZ=nullptr)
 
float getMapWaterOrGroundLevel (float x, float y, float z, float *ground=nullptr)
 
float getFloorZ ()
 
float getMapHeight (LocationVector pos, bool vmap=true, float distanceToSearch=50.0f)
 
void movePositionToFirstCollision (LocationVector &pos, float dist, float angle)
 
LocationVector getFirstCollisionPosition (float dist, float angle)
 
GameObjectsummonGameObject (uint32_t entryID, LocationVector pos, QuaternionData const &rot, uint32_t spawnTime=0, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
CreaturesummonCreature (uint32_t entry, LocationVector position, CreatureSummonDespawnType despawnType=MANUAL_DESPAWN, uint32_t duration=0, uint32_t spellId=0)
 
float getDistanceSq (Object const *obj) const
 
float CalcDistance (LocationVector &comp)
 
float GetDistance2dSq (Object *obj)
 
virtual void outPacket (uint16_t, uint16_t, const void *)
 
virtual void sendPacket (WorldPacket *)
 
void SendCreatureChatMessageInRange (Creature *creature, uint32_t textId, Unit *target=nullptr)
 
virtual void sendMessageToSet (WorldPacket *data, bool self, bool myteam_only=false)
 
virtual void sendMessageToSet (WorldPacket *data, Player const *)
 
virtual void outPacketToSet (uint16_t Opcode, uint16_t Len, const void *Data, bool self)
 
void SendAIReaction (uint32_t reaction=2)
 
void SendDestroyObject ()
 
uint16_t GetValuesCount () const
 
uint32_t GetPhase () const
 
virtual void Phase (uint8_t command=PHASE_SET, uint32_t newphase=1)
 
void SendSpellLog (Object *Caster, Object *Target, uint32_t Ability, uint8_t SpellLogType)
 SpellLog packets just to keep the code cleaner and better to read.
 
void setServersideFaction ()
 
uint32_t getServersideFaction ()
 
Standing getEnemyReaction (Object *target)
 
Standing getFactionReaction (WDB::Structures::FactionTemplateEntry const *factionTemplateEntry, Object *target)
 
bool isHostileTo (Object *target)
 
bool IsHostileToPlayers ()
 
bool isFriendlyTo (Object *target)
 
bool isNeutralTo (Object *target) const
 
bool isNeutralToAll () const
 
bool isValidTarget (Object *target, SpellInfo const *bySpell=nullptr)
 
bool isValidAssistTarget (Unit *target, SpellInfo const *bySpell=nullptr)
 
void SetInstanceID (int32_t instance)
 
int32_t GetInstanceID ()
 
int32_t event_GetInstanceID ()
 this func needs to be implemented by all eventable classes. use it to retrieve the instance id that it needs to attach itself to.
 
bool IsActive ()
 
virtual bool CanActivate ()
 Object has an active state.
 
virtual void Activate (WorldMap *mgr)
 
void SetMapMgr (WorldMap *mgr)
 
void Delete ()
 
void PlaySoundToSet (uint32_t sound_entry)
 
bool IsInBg ()
 
uint32_t GetTeam () const
 
bool GetPoint (float angle, float rad, float &outx, float &outy, float &outz, bool sloppypath=false)
 
bool GetRandomPoint (float rad, float &outx, float &outy, float &outz)
 
bool GetRandomPoint (float rad, LocationVector &out)
 
- Public Member Functions inherited from EventableObject
uint32_t event_GetEventPeriod (uint32_t EventType)
 
 EventableObject ()
 
virtual ~EventableObject ()
 
bool event_HasEvents ()
 
void event_AddEvent (std::shared_ptr< TimedEvent > ptr)
 
void event_Relocate ()
 

Public Attributes

int32_t m_CombatResult_Dodge = 0
 
int32_t m_CombatResult_Parry = 0
 
float m_zAxisPosition = 0.0f
 
int32_t m_safeFall = 0
 
bool m_noFallDamage = false
 
uint8_t m_forced_speed_changes [MAX_SPEED_TYPE] = { 0 }
 
std::unique_ptr< MovementMgr::MoveSplinemovespline
 
Unitm_controledUnit = this
 
Playerm_playerControler = nullptr
 
float m_spellCritPercentage = 0.0f
 
int32_t m_silenced = 0
 
int32_t m_modlanguage = -1
 
uint32_t m_objectSlots [4] = { 0 }
 
Loot loot
 
uint16_t m_noInterrupt = 0
 
uint32_t m_triggerOnStun = 0
 
uint32_t m_triggerOnStunChance = 100
 
uint32_t m_triggerOnStunVictim = 0
 
uint32_t m_triggerOnStunChanceVictim = 100
 
uint32_t m_triggerOnChill = 0
 
uint32_t m_triggerOnChillChance = 100
 
uint32_t m_triggerOnChillVictim = 0
 
uint32_t m_triggerOnChillChanceVictim = 100
 
std::unique_ptr< DamageSplitTargetm_damageSplitTarget
 
std::list< std::unique_ptr< ReflectSpellSchool > > m_reflectSpellSchool
 
bool m_damageShieldsInUse = false
 
std::list< DamageProcm_damageShields
 
uint32_t m_canMove = 0
 
float m_hitFromMeleeSpell = 0.0f
 
int32_t m_pacified = 0
 
int32_t m_stunned = 0
 
int32_t m_fearModifiers = 0
 
int32_t m_resistChance = 0
 
uint32_t m_schoolCastPrevent [TOTAL_SPELL_SCHOOLS] = {0}
 
int32_t m_mechanicDurationPctMod [28] = {0}
 
int32_t m_damageTakenMod [TOTAL_SPELL_SCHOOLS] = {0}
 
float m_damageTakenPctMod [TOTAL_SPELL_SCHOOLS] = {0}
 
float m_damageTakenPctModOnHP35 = 1
 
float m_critMeleeDamageTakenPctMod [TOTAL_SPELL_SCHOOLS] = {0}
 
float m_critRangedDamageTakenPctMod [TOTAL_SPELL_SCHOOLS] = {0}
 
int32_t m_rangedDamageTaken = 0
 
float m_baseDamage [2] = {0}
 
float m_baseOffhandDamage [2] = {0}
 
float m_baseRangedDamage [2] = {0}
 
int32_t m_rangeAttackPowerModifier = 0
 
int32_t m_attackPowerModifier = 0
 
uint64_t m_stalkedByGuid = 0
 
uint32_t m_dispels [10] = {0}
 
bool m_trackStealth = false
 
uint32_t m_mechanicsDispels [32] = {0}
 
float m_mechanicsResistancesPct [32] = {0}
 
float m_modDamageTakenByMechPct [32] = {0}
 
int32_t m_DoTPctIncrease [TOTAL_SPELL_SCHOOLS] = {0}
 
float m_AOEDmgMod = 1.0f
 
float m_ignoreArmorPctMaceSpec = 0.0f
 
float m_ignoreArmorPct = 0.0f
 
std::map< uint32_t, Aura * > m_tempAuraMap
 
uint32_t m_baseResistance [TOTAL_SPELL_SCHOOLS] = {0}
 
uint32_t m_baseStats [5] = {0}
 
int32_t m_healDoneMod [TOTAL_SPELL_SCHOOLS] = {0}
 
float m_healDonePctMod [TOTAL_SPELL_SCHOOLS] = {0}
 
int32_t m_healTakenMod [TOTAL_SPELL_SCHOOLS] = {0}
 
float m_healTakenPctMod [TOTAL_SPELL_SCHOOLS] = {0}
 
uint32_t m_schoolImmunityList [TOTAL_SPELL_SCHOOLS] = {0}
 
float m_spellCritChanceSchool [TOTAL_SPELL_SCHOOLS] = {0}
 
float m_powerCostPctMod [TOTAL_SPELL_SCHOOLS] = {0}
 
int32_t m_attackerCritChanceMod [TOTAL_SPELL_SCHOOLS] = {0}
 
uint32_t m_spellDelayResist [TOTAL_SPELL_SCHOOLS] = {0}
 
int32_t m_creatureAttackPowerMod [12] = {0}
 
int32_t m_creatureRangedAttackPowerMod [12] = {0}
 
int32_t m_interruptRegen = 0
 
int32_t m_powerRegenPct = 0
 
int32_t m_extraAttacks = 0
 
bool m_extraStrikeTarget = false
 
int32_t m_extraStrikeTargetC = 0
 
std::list< std::unique_ptr< ExtraStrike > > m_extraStrikeTargets
 
int64_t m_magnetCasterGuid = 0
 
int8_t m_ascFrozen = 0
 
int8_t m_ascEnraged = 0
 
int8_t m_ascSeal = 0
 
int8_t m_ascBleed = 0
 
bool m_isDisarmed = false
 
uint64_t m_detectRangeGuids [5] = {0}
 
int32_t m_detectRangeMods [5] = {0}
 
uint16_t m_diminishCount [DIMINISHING_GROUP_COUNT] = {0}
 
uint8_t m_diminishAuraCount [DIMINISHING_GROUP_COUNT] = {0}
 
uint16_t m_diminishTimer [DIMINISHING_GROUP_COUNT] = {0}
 
bool m_diminishActive = false
 
DynamicObjectm_dynamicObject = nullptr
 
bool m_isProcInUse = false
 
bool m_isInvincible = false
 
Playerm_redirectSpellPackets = nullptr
 
struct { 
 
   int32_t   m_amount = 0 
 
   int32_t   m_max = 0 
 
m_soulSiphon 
 
- Public Attributes inherited from Object
MovementInfo obj_movement_info
 
uint32_t m_phase = 1
 
WDB::Structures::FactionTemplateEntry constm_factionTemplate = nullptr
 
WDB::Structures::FactionEntry constm_factionEntry = nullptr
 
bool m_inQueue = false
 
bool m_loadedFromDB = false
 
std::set< Spell * > m_pendingSpells
 

Protected Types

typedef std::list< GameObject * > GameObjectList
 

Protected Member Functions

 Unit ()
 
void setFeared (bool apply)
 
void setConfused (bool apply)
 
void setStunned (bool apply)
 
void _regeneratePowersAtRegenUpdate (PowerType type)
 
- Protected Member Functions inherited from Object
const WoWObjectobjectData () const
 
void _Create (uint32_t mapid, float x, float y, float z, float ang)
 
virtual void setUpdateBits (UpdateMask *updateMask, Player *target) const
 
virtual void setCreateBits (UpdateMask *updateMask, Player *target) const
 
void buildMovementUpdate (ByteBuffer *data, uint16_t updateFlags, Player *target)
 
void buildValuesUpdate (uint8_t updateType, ByteBuffer *data, UpdateMask *updateMask, Player *target)
 
bool inArc (float Position1X, float Position1Y, float FOV, float Orientation, float Position2X, float Position2Y)
 
- Protected Member Functions inherited from EventableObject
void event_RemoveEvents ()
 
void event_RemoveEvents (uint32_t EventType)
 
void event_ModifyTimeLeft (uint32_t EventType, time_t TimeLeft, bool unconditioned=false)
 
void event_ModifyTime (uint32_t EventType, time_t Time)
 
void event_ModifyTimeAndTimeLeft (uint32_t EventType, time_t Time)
 
bool event_HasEvent (uint32_t EventType)
 
void event_RemoveByPointer (TimedEvent *ev)
 
int32_t event_GetCurrentInstanceId () const
 
bool event_GetTimeLeft (uint32_t EventType, time_t *Time)
 

Protected Attributes

std::unique_ptr< MovementManageri_movementManager
 
std::unique_ptr< AIInterfacem_aiInterface
 
bool m_useAI = false
 
uint32_t m_lastAiInterfaceUpdateTime = 0
 
uint16_t m_healthRegenerateTimer = 0
 
uint16_t m_powerRegenerateTimer = 0
 
uint16_t m_powerUpdatePacketTime = 0
 
GameObjectList m_gameObj
 
DeathState m_deathState = ALIVE
 
std::list< std::unique_ptr< Aura > > m_GarbageAuras
 
std::list< Pet * > m_GarbagePets
 
uint64_t m_auraRaidUpdateMask = 0
 
bool m_extraAttackCounter = false
 
uint32_t m_meleeSpell = 0
 
uint8_t m_meleeSpell_ecn = 0
 
bool m_canParry = false
 
uint32_t m_tempCharm = 0
 
float m_modelHalfSize = 1.0f
 
float m_blockFromSpell = 0.0f
 
float m_dodgeFromSpell = 0.0f
 
float m_parryFromSpell = 0.0f
 
int32_t m_manashieldAmount = 0
 
uint32_t m_manaShieldId = 0
 
UniqueAuraTargetMap m_singleTargetAura
 
uint32_t m_blockModPct = 0
 
- Protected Attributes inherited from Object
union { 
 
   uint8_t *   wow_data_ptr 
 
   WoWObject *   wow_data 
 
   uint32_t *   m_uint32Values = nullptr 
 
};  
 
uint8_t m_objectTypeId = TYPEID_UNIT
 
WoWGuid m_wowGuid
 
uint16_t m_objectType
 
uint16_t m_updateFlag
 
bool m_outdoors
 
ZLiquidStatus m_liquidStatus
 
float m_staticFloorZ = -100000.0f
 
uint32_t m_zoneId = 0
 
uint32_t m_areaId = 0
 
uint32_t m_mapId = MAPID_NOT_IN_WORLD
 
WorldMapm_WorldMap = nullptr
 
uint32_t m_mapCell_x = uint32_t(-1)
 
uint32_t m_mapCell_y = uint32_t(-1)
 
LocationVector m_position = {0, 0, 0, 0}
 
LocationVector m_lastMapUpdatePosition
 
LocationVector m_spawnLocation = { 0, 0, 0, 0 }
 
uint16_t m_valuesCount = 0
 
UpdateMask m_updateMask
 
bool m_objectUpdated = false
 
int32_t m_instanceId = INSTANCEID_NOT_IN_WORLD
 
Transporterm_transport = nullptr
 
- Protected Attributes inherited from EventableObject
int32_t m_event_Instanceid
 
std::mutex m_lock
 
EventMap m_events
 
EventableObjectHolderm_holder
 

Private Member Functions

const WoWUnitunitData () const
 
void updateSplineMovement (uint32_t t_diff)
 
void updateSplinePosition ()
 
void _addAura (std::unique_ptr< Aura > aur)
 
void _addAuraEffect (AuraEffectModifier const *aurEff)
 
std::unique_ptr< Aura_removeAura (Aura *aur)
 
void _removeAuraEffect (AuraEffectModifier const *aurEff)
 
void _updateAuras (unsigned long diff)
 
uint8_t getPowerIndexFromDBC (PowerType type) const
 
void _updateHealth ()
 
uint32_t _handleBatchDamage (HealthBatchEvent const *batch, uint32_t *rageGenerated)
 
uint32_t _handleBatchHealing (HealthBatchEvent const *batch, uint32_t *absorbedHeal)
 

Private Attributes

CombatHandler m_combatHandler
 
int32_t m_rootCounter = 0
 
UnitSpeedInfo m_UnitSpeedInfo
 
int32_t m_speedModifier = 0
 
int32_t m_mountedspeedModifier = 0
 
int32_t m_flyspeedModifier = 0
 
int32_t m_slowdown = 0
 
float m_maxSpeed = 0
 
std::map< uint32_t, int32_tspeedReductionMap
 
std::unordered_set< AbstractFollower * > m_followingMe
 
int32_t m_splineSyncTimer = 5000
 
uint32_t m_unitState = 0
 
bool m_canDualWield = false
 
std::list< std::unique_ptr< SpellProc > > m_procSpells
 
std::list< AuraEffectModifier const * > m_spellModifiers [MAX_SPELLMOD_TYPE]
 
uint32_t m_spellImmunityMask = SPELL_IMMUNITY_NONE
 
uint32_t m_transformAura = 0
 
AuraArray m_auraList
 
AuraEffectListArray m_auraEffectList
 
VisualAuraArray m_auraVisualList = { 0 }
 
int32_t m_stealthLevel [STEALTH_FLAG_TOTAL] = {0}
 
int32_t m_stealthDetection [STEALTH_FLAG_TOTAL] = {0}
 
int32_t m_invisibilityLevel [INVIS_FLAG_TOTAL] = {0}
 
int32_t m_invisibilityDetection [INVIS_FLAG_TOTAL] = {0}
 
uint32_t m_healthRegenerationInterruptTime = 0
 
float_t m_powerFractions [TOTAL_PLAYER_POWER_TYPES] = {0}
 
uint32_t m_attackTimer [TOTAL_WEAPON_DAMAGE_TYPES] = {0}
 
float m_attackSpeed [TOTAL_WEAPON_DAMAGE_TYPES] = { 1.0f, 1.0f, 1.0f }
 
std::vector< std::unique_ptr< HealthBatchEvent > > m_healthBatch
 
uint16_t m_healthBatchTime = HEALTH_BATCH_INTERVAL
 
uint32_t m_lastSpellUpdateTime = 0
 
uint32_t m_oldEmote = 0
 
std::unique_ptr< SummonHandlerm_summonInterface
 
ThreatManager m_threatManager = this
 
int32_t m_threatModifyer = 0
 
int32_t m_generatedThreatModifyer [TOTAL_SPELL_SCHOOLS] = { 0 }
 
uint64_t m_taggerGuid = 0
 
bool m_taggedBySummon = false
 

Friends

class ThreatManager
 
class AIInterface
 
class Aura
 

Detailed Description

Definition at line 146 of file Unit.hpp.

Member Typedef Documentation

◆ GameObjectList

typedef std::list<GameObject*> Unit::GameObjectList
protected

Definition at line 1110 of file Unit.hpp.

Constructor & Destructor Documentation

◆ Unit()

Unit::Unit ( )
protected

Definition at line 90 of file Unit.cpp.

90 :
91 movespline(std::make_unique<MovementMgr::MoveSpline>()),
92 i_movementManager(std::make_unique<MovementManager>(this)),
93 m_summonInterface(std::make_unique<SummonHandler>(this)),
94 m_combatHandler(this),
95 m_aiInterface(std::make_unique<AIInterface>()),
96#ifdef FT_VEHICLES
97 m_vehicleKit(nullptr),
98#endif
99 m_damageSplitTarget(nullptr)
100{
102
103#if VERSION_STRING < Cata
105#else
107#endif
108
110
111 std::fill(m_auraList.begin(), m_auraList.end(), nullptr);
112
113 m_aiInterface->Init(this);
115}
@ UPDATEFLAG_HAS_POSITION
Definition Flags.hpp:30
@ UPDATEFLAG_LIVING
Definition Flags.hpp:29
@ TYPE_UNIT
uint16_t m_updateFlag
Definition Object.hpp:722
uint16_t m_objectType
Definition Object.hpp:719
CombatHandler m_combatHandler
Definition Unit.hpp:561
std::unique_ptr< MovementManager > i_movementManager
Definition Unit.hpp:668
std::unique_ptr< AIInterface > m_aiInterface
Definition Unit.hpp:700
std::unique_ptr< SummonHandler > m_summonInterface
Definition Unit.hpp:1137
std::unique_ptr< MovementMgr::MoveSpline > movespline
Definition Unit.hpp:648
uint32_t m_lastAiInterfaceUpdateTime
Definition Unit.hpp:702
ThreatManager & getThreatManager()
Definition Unit.hpp:1190
std::unique_ptr< DamageSplitTarget > m_damageSplitTarget
Definition Unit.hpp:1277
AuraArray m_auraList
Definition Unit.hpp:903
uint32_t getMSTime()
Definition Util.cpp:143
Here is the call graph for this function:

◆ ~Unit()

Unit::~Unit ( )
virtual

Definition at line 117 of file Unit.cpp.

118{
120
121 for (uint8_t i = 0; i < CURRENT_SPELL_MAX; ++i)
122 {
123 if (getCurrentSpell(static_cast<CurrentSpellType>(i)) != nullptr)
125 }
126
127 for (uint8_t i = 0; i < MAX_SPELLMOD_TYPE; ++i)
128 m_spellModifiers[i].clear();
129
130 for (auto extraStrikeTarget = m_extraStrikeTargets.begin(); extraStrikeTarget != m_extraStrikeTargets.end(); ++extraStrikeTarget)
131 {
132 const auto& extraStrike = *extraStrikeTarget;
133 sLogger.failure("ExtraStrike added to Unit {} by Spell ID {} wasn't removed when removing the Aura", getGuid(), extraStrike->spell_info->getId());
134 }
135 m_extraStrikeTargets.clear();
136
137 // delete auras which did not get added to unit yet
138 for (auto tempAura = m_tempAuraMap.begin(); tempAura != m_tempAuraMap.end(); ++tempAura)
139 delete tempAura->second;
140
141 m_tempAuraMap.clear();
142
143 m_procSpells.clear();
144
145 m_singleTargetAura.clear();
146
147 m_summonInterface->removeAllSummons();
148
150
152
155}
#define sLogger
Definition Logger.hpp:136
CurrentSpellType
Definition Object.hpp:65
@ CURRENT_SPELL_MAX
Definition Object.hpp:70
@ MAX_SPELLMOD_TYPE
uint64_t getGuid() const
Definition Object.cpp:295
void interruptSpellWithSpellType(CurrentSpellType spellType)
Definition Object.cpp:713
Spell * getCurrentSpell(CurrentSpellType spellType) const
Definition Object.cpp:600
void removeMeFromThreatLists()
std::map< uint32_t, Aura * > m_tempAuraMap
Definition Unit.hpp:1440
void removeGarbage()
Definition Unit.cpp:8926
std::list< std::unique_ptr< SpellProc > > m_procSpells
Definition Unit.hpp:795
std::list< std::unique_ptr< ExtraStrike > > m_extraStrikeTargets
Definition Unit.hpp:1469
void clearHealthBatch()
Definition Unit.cpp:7488
UniqueAuraTargetMap m_singleTargetAura
Definition Unit.hpp:1536
std::list< AuraEffectModifier const * > m_spellModifiers[MAX_SPELLMOD_TYPE]
Definition Unit.hpp:797
void removeAllAuras()
Definition Unit.cpp:5239
unsigned char uint8_t
Here is the call graph for this function:

Member Function Documentation

◆ _addAura()

void Unit::_addAura ( std::unique_ptr< Aura aur)
private

Definition at line 5792 of file Unit.cpp.

5793{
5794 if (aur == nullptr)
5795 return;
5796
5797 for (uint8_t i = 0; i < MAX_SPELL_EFFECTS; ++i)
5798 {
5799 const auto aurEff = aur->getAuraEffect(i);
5800 if (aurEff->getAuraEffectType() == SPELL_AURA_NONE)
5801 continue;
5802
5803 _addAuraEffect(aurEff);
5804 }
5805
5806 m_auraList[aur->getAuraSlot()] = std::move(aur);
5807}
@ SPELL_AURA_NONE
static constexpr uint8_t MAX_SPELL_EFFECTS
void _addAuraEffect(AuraEffectModifier const *aurEff)
Definition Unit.cpp:5809
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _addAuraEffect()

void Unit::_addAuraEffect ( AuraEffectModifier const aurEff)
private

Definition at line 5809 of file Unit.cpp.

5810{
5811 if (aurEff == nullptr)
5812 return;
5813
5814 m_auraEffectList[aurEff->getAuraEffectType()].push_back(aurEff);
5815}
AuraEffectListArray m_auraEffectList
Definition Unit.hpp:904
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _handleBatchDamage()

uint32_t Unit::_handleBatchDamage ( HealthBatchEvent const batch,
uint32_t rageGenerated 
)
private

\ todo: this is inaccurate

\ todo: fix this, currently used for root and fear auras

\ todo: fix this, currently used for root and fear auras

Definition at line 7760 of file Unit.cpp.

7761{
7762 const auto spellId = batch->spellInfo != nullptr ? batch->spellInfo->getId() : 0;
7763 auto damage = batch->damageInfo.realDamage;
7764
7765 const auto attacker = batch->caster;
7766 if (attacker != nullptr && attacker != this)
7767 {
7768 if (attacker->isPlayer())
7769 {
7770 const auto plr = dynamic_cast<Player*>(attacker);
7771 if (!plr->getSession()->hasPermissions() && worldConfig.limit.isLimitSystemEnabled != 0)
7772 damage = plr->checkDamageLimits(damage, spellId);
7773 }
7774
7775 // Rage generation for victim
7776 ///\ todo: this is inaccurate
7778 {
7779 const auto level = static_cast<float_t>(getLevel());
7780 const float_t c = 0.0091107836f * level * level + 3.225598133f * level + 4.2652911f;
7781
7782 float_t val = 2.5f * damage / c;
7783 const auto rage = getPower(POWER_TYPE_RAGE);
7784
7785 if (rage + Util::float2int32(val) > 1000)
7786 val = 1000.0f - static_cast<float>(getPower(POWER_TYPE_RAGE));
7787
7788 val *= 10.0;
7789 *rageGenerated = Util::float2int32(val);
7790 }
7791
7792 const auto plrOwner = attacker->getPlayerOwnerOrSelf();
7793 if (plrOwner != nullptr)
7794 {
7795 // Battleground damage score
7796 if (plrOwner->getBattleground() && getWorldMap() == attacker->getWorldMap())
7797 {
7798 plrOwner->m_bgScore.DamageDone += damage;
7799 plrOwner->getBattleground()->updatePvPData();
7800 }
7801 }
7802
7803 // Make victim's pets react to attacker
7804 m_summonInterface->notifyOnOwnerAttacked(attacker);
7805 }
7806
7807 // Create heal effect for leech effects
7808 if (batch->isLeech && attacker != nullptr && attacker != this)
7809 {
7810 // Leech damage can be more than victim's health but the heal should not exceed victim's remaining health
7811 auto healAmount = std::min(damage, getHealth());
7812 if (batch->spellInfo != nullptr && batch->spellInfo->hasEffectApplyAuraName(SPELL_AURA_PERIODIC_HEALTH_FUNNEL))
7813 {
7814 // but health funnel periodic effects can heal more than victim's health
7815 healAmount = damage;
7816 }
7817
7818 attacker->doSpellHealing(attacker, spellId, healAmount * batch->leechMultipleValue, false, batch->isPeriodic, true, false);
7819 }
7820
7822
7823 // Check for auras which are interrupted on damage taken
7824 // But do not remove the aura created by this spell
7825 if (spellId != 0)
7826 {
7828 ///\ todo: fix this, currently used for root and fear auras
7829 if (Util::checkChance(35.0f))
7831 }
7832 else
7833 {
7835 ///\ todo: fix this, currently used for root and fear auras
7836 if (Util::checkChance(35.0f))
7838 }
7839
7840 return damage;
7841}
@ SPELL_AURA_PERIODIC_HEALTH_FUNNEL
@ AURA_INTERRUPT_ON_ANY_DAMAGE_TAKEN
@ AURA_INTERRUPT_ON_UNUSED2
@ POWER_TYPE_RAGE
Definition PowerType.hpp:14
@ STANDSTATE_STAND
#define worldConfig
Definition World.h:245
WorldMap * getWorldMap() const
Definition Object.hpp:454
uint32_t checkDamageLimits(uint32_t damage, uint32_t spellId)
Definition Player.cpp:13289
void setStandState(uint8_t standState)
Definition Unit.cpp:1366
PowerType getPowerType() const
Definition Unit.cpp:462
uint32_t getHealth() const
Definition Unit.cpp:481
uint32_t getPower(PowerType type) const
Definition Unit.cpp:516
void removeAllAurasByAuraInterruptFlag(uint32_t auraInterruptFlag, uint32_t skipSpellId=0)
Definition Unit.cpp:5290
uint32_t getLevel() const
Definition Unit.cpp:936
int32_t float2int32(float value)
Definition Narrow.cpp:18
bool checkChance(uint32_t val)
Definition Random.cpp:56
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _handleBatchHealing()

uint32_t Unit::_handleBatchHealing ( HealthBatchEvent const batch,
uint32_t absorbedHeal 
)
private

\ todo: implement (aura effect 301)

Definition at line 7843 of file Unit.cpp.

7844{
7845 auto healing = batch->damageInfo.realDamage;
7846
7847 // Handle heal absorb
7848 ///\ todo: implement (aura effect 301)
7849 *absorbedHeal = 0;
7850
7851 const auto healer = batch->caster;
7852 if (healer )
7853 {
7854 const auto plrOwner = healer->getPlayerOwnerOrSelf();
7855
7856 // Update battleground score
7857 if (plrOwner && plrOwner->getBattleground() && plrOwner->getWorldMap() == getWorldMap())
7858 {
7859 plrOwner->m_bgScore.HealingDone += healing;
7860 plrOwner->getBattleground()->updatePvPData();
7861 }
7862 }
7863
7865
7866 return healing;
7867}
bool removeAurasByHeal()
Definition Unit.cpp:9579
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _regeneratePowersAtRegenUpdate()

void Unit::_regeneratePowersAtRegenUpdate ( PowerType  type)
protected

Definition at line 6761 of file Unit.cpp.

6762{
6763 // Before power regeneration is updated there must be a regeneration update with old values
6764#if VERSION_STRING < WotLK
6765 switch (type)
6766 {
6767 case POWER_TYPE_MANA:
6768 case POWER_TYPE_ENERGY:
6769 // Mana and energy are linked together with same timer
6770 regeneratePower(POWER_TYPE_MANA, m_manaEnergyRegenerateTimer);
6771 regeneratePower(POWER_TYPE_ENERGY, m_manaEnergyRegenerateTimer);
6772 m_manaEnergyRegenerateTimer = 0;
6773 break;
6774 case POWER_TYPE_RAGE:
6775 regeneratePower(POWER_TYPE_RAGE, m_rageRegenerateTimer);
6776 m_rageRegenerateTimer = 0;
6777 break;
6778 case POWER_TYPE_FOCUS:
6779 regeneratePower(POWER_TYPE_FOCUS, m_focusRegenerateTimer);
6780 m_focusRegenerateTimer = 0;
6781 break;
6782 default:
6783 break;
6784 }
6785#else
6786 // In wotlk all powers are on same timer so must update all
6790 if (isPlayer())
6791 {
6794 }
6795
6799#endif
6800}
@ POWER_TYPE_RUNIC_POWER
Definition PowerType.hpp:24
@ POWER_TYPE_FOCUS
Definition PowerType.hpp:15
@ POWER_TYPE_MANA
Definition PowerType.hpp:13
@ POWER_TYPE_ENERGY
Definition PowerType.hpp:16
@ REGENERATION_PACKET_UPDATE_INTERVAL
bool isPlayer() const
Definition Object.cpp:569
uint16_t m_powerUpdatePacketTime
Definition Unit.hpp:989
uint16_t m_powerRegenerateTimer
Definition Unit.hpp:988
void regeneratePower(PowerType type, uint16_t timePassed)
Definition Unit.cpp:6447
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _removeAura()

std::unique_ptr< Aura > Unit::_removeAura ( Aura aur)
private

Definition at line 5817 of file Unit.cpp.

5818{
5819 if (aur == nullptr)
5820 return nullptr;
5821
5822 auto&& tmp = std::move(m_auraList[aur->getAuraSlot()]);
5823 return tmp;
5824}
uint16_t getAuraSlot() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _removeAuraEffect()

void Unit::_removeAuraEffect ( AuraEffectModifier const aurEff)
private

Definition at line 5826 of file Unit.cpp.

5827{
5828 if (aurEff == nullptr)
5829 return;
5830
5831 m_auraEffectList[aurEff->getAuraEffectType()].remove(aurEff);
5832}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _updateAuras()

void Unit::_updateAuras ( unsigned long  diff)
private

Definition at line 5834 of file Unit.cpp.

5835{
5837 {
5838 if (auto* const aur = getAuraWithAuraSlot(i))
5839 aur->update(diff);
5840 }
5841}
Aura * getAuraWithAuraSlot(uint16_t auraSlot) const
Definition Unit.cpp:4944
@ TOTAL_SLOT_START
Definition AuraSlots.hpp:51
unsigned short uint16_t
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _updateHealth()

void Unit::_updateHealth ( )
private

Definition at line 7663 of file Unit.cpp.

7664{
7665 const auto curHealth = getHealth();
7666 int32_t healthVal = 0;
7667 uint32_t totalAbsorbDamage = 0;
7668 // Victim's rage generation on damage taken
7669 int32_t totalRageGenerated = 0;
7670
7671 Unit* killer = nullptr;
7672 // Get single damager from entire batch for creature scripts
7673 Unit* singleDamager = nullptr;
7674
7675 // Process through health batch
7676 auto batchItr = m_healthBatch.begin();
7677 while (batchItr != m_healthBatch.end())
7678 {
7679 const auto& batch = *batchItr;
7680
7681 if (batch->isHeal)
7682 {
7683 uint32_t absorbedHeal = 0;
7684 const auto heal = _handleBatchHealing(batch.get(), &absorbedHeal);
7685 healthVal += heal;
7686
7687 const int32_t diff = curHealth + healthVal;
7688 // Check if unit got healed in the same batch where it received a fataling blow
7689 if (diff > 0)
7690 {
7691 // Reset killer
7692 killer = nullptr;
7693 }
7694 }
7695 else
7696 {
7697 uint32_t rageGenerated = 0;
7698 const auto damage = _handleBatchDamage(batch.get(), &rageGenerated);
7699 healthVal -= damage;
7700
7701 singleDamager = batch->caster;
7702
7703 totalAbsorbDamage += batch->damageInfo.absorbedDamage;
7704 totalRageGenerated += rageGenerated;
7705
7706 const int32_t diff = curHealth + healthVal;
7707 if (diff <= 0)
7708 {
7709 // Set killer if health event has overkill and killer does not exist yet
7710 if (killer == nullptr)
7711 killer = batch->caster;
7712 }
7713 }
7714
7715 batchItr = m_healthBatch.erase(batchItr);
7716 }
7717
7718 // Do the real absorb damage
7719 absorbDamage(SCHOOL_MASK_ALL, &totalAbsorbDamage, false);
7720
7721 // If the value is negative, then damage in the batch exceeds healing and unit takes damage
7722 if (healthVal < 0)
7723 takeDamage(killer != nullptr ? killer : singleDamager, static_cast<uint32_t>(std::abs(healthVal)), 0);
7724 else
7725 setHealth(curHealth + healthVal);
7726
7727 // Generate rage on damage taken
7728 if (totalRageGenerated > 0)
7729 modPower(POWER_TYPE_RAGE, totalRageGenerated);
7730
7731 // Update health based aurastates
7732 const auto healthPct = getHealthPct();
7733
7734 // This is for some reason called after death so make sure unit has health
7735 // This prevents Execute/Hammer of Wrath/Kill Shot showing on dead units
7736 if (healthPct == 0)
7737 return;
7738
7739 // Health below 35%
7740 if (healthPct < 35)
7742 else
7744
7745 // Health below 20%
7746 if (healthPct < 20)
7748 else
7750
7751#if VERSION_STRING >= WotLK
7752 // Health above 75%
7753 if (healthPct > 75)
7755 else
7757#endif
7758}
@ AURASTATE_FLAG_HEALTH75
@ AURASTATE_FLAG_HEALTH20
@ AURASTATE_FLAG_HEALTH35
G3D::Matrix abs(const G3D::Matrix &M)
Definition Matrix.h:632
@ SCHOOL_MASK_ALL
Definition School.hpp:35
Definition Unit.hpp:147
void removeAuraStateAndAuras(AuraState state)
Definition Unit.cpp:5168
std::vector< std::unique_ptr< HealthBatchEvent > > m_healthBatch
Definition Unit.hpp:1102
void modPower(PowerType type, int32_t value)
Definition Unit.cpp:614
void setHealth(uint32_t health)
Definition Unit.cpp:482
void takeDamage(Unit *attacker, uint32_t damage, uint32_t spellId)
Definition Unit.cpp:7158
uint32_t absorbDamage(SchoolMask schoolMask, uint32_t *dmg, bool checkOnly=true)
Definition Unit.cpp:7509
uint8_t getHealthPct() const
Definition Unit.cpp:6704
void addAuraStateAndAuras(AuraState state)
Definition Unit.cpp:5147
uint32_t _handleBatchHealing(HealthBatchEvent const *batch, uint32_t *absorbedHeal)
Definition Unit.cpp:7843
uint32_t _handleBatchDamage(HealthBatchEvent const *batch, uint32_t *rageGenerated)
Definition Unit.cpp:7760
Definition g3dmath.h:935
unsigned int uint32_t
signed int int32_t
Here is the call graph for this function:
Here is the caller graph for this function:

◆ absorbDamage()

uint32_t Unit::absorbDamage ( SchoolMask  schoolMask,
uint32_t dmg,
bool  checkOnly = true 
)

Definition at line 7509 of file Unit.cpp.

7510{
7511 if (dmg == nullptr)
7512 return 0;
7513
7514 uint32_t totalAbsorbedDamage = 0;
7515 for (auto& aur : getAuraList())
7516 {
7517 if (aur == nullptr || !aur->isAbsorbAura())
7518 continue;
7519
7520 AbsorbAura* abs = dynamic_cast<AbsorbAura*>(aur.get());
7521 totalAbsorbedDamage += abs->absorbDamage(schoolMask, dmg, checkOnly);
7522 }
7523
7524 if (isPlayer() && dynamic_cast<Player*>(this)->m_cheats.hasGodModeCheat)
7525 {
7526 totalAbsorbedDamage += *dmg;
7527 *dmg = 0;
7528 }
7529
7530 return totalAbsorbedDamage;
7531}
AuraArray const & getAuraList() const
Definition Unit.cpp:5747
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addAura()

void Unit::addAura ( std::unique_ptr< Aura aur)

\ todo: notify client that aura did not apply

\ todo: notify client that aura did not apply

\ todo: this supports only single auras. Missing paladin seals, warlock curses etc

\ todo: probably should add check for passive aura stacking

Definition at line 4538 of file Unit.cpp.

4539{
4540 if (auraHolder == nullptr)
4541 return;
4542
4543 if (!isAlive() && !auraHolder->getSpellInfo()->isDeathPersistent())
4544 return;
4545
4546 // Check school immunity
4547 const auto school = auraHolder->getSpellInfo()->getFirstSchoolFromSchoolMask();
4548 if (school != SCHOOL_NORMAL && m_schoolImmunityList[school] && auraHolder->getCasterGuid() != getGuid())
4549 {
4550 ///\ todo: notify client that aura did not apply
4551 return;
4552 }
4553
4554 // Check if aura has effects
4555 if (auraHolder->getAppliedEffectCount() == 0)
4556 {
4557 ///\ todo: notify client that aura did not apply
4558 return;
4559 }
4560
4561 // Check for flying mount
4562 // This is already checked in Spell::canCast but this could happen on teleport or login
4563 if (isPlayer() && auraHolder->getSpellInfo()->getAttributesExD() & ATTRIBUTESEXD_ONLY_IN_OUTLANDS)
4564 {
4565 if (!dynamic_cast<Player*>(this)->canUseFlyingMountHere())
4566 {
4567 if (GetMapId() != 571 || !(auraHolder->getSpellInfo()->getAttributesExG() & ATTRIBUTESEXG_IGNORE_COLD_WEATHER_FLYING))
4568 return;
4569 }
4570 }
4571
4572 // Check for single target aura
4573 ///\ todo: this supports only single auras. Missing paladin seals, warlock curses etc
4574 if (auraHolder->getSpellInfo()->getAttributesExE() & ATTRIBUTESEXE_SINGLE_TARGET_AURA)
4575 {
4576 uint64_t previousTargetGuid = 0;
4577
4578 const auto caster = auraHolder->GetUnitCaster();
4579 if (caster != nullptr)
4580 {
4581 previousTargetGuid = caster->getSingleTargetGuidForAura(auraHolder->getSpellId());
4582
4583 // Check if aura is applied on different unit
4584 if (previousTargetGuid != 0 && previousTargetGuid != auraHolder->getOwner()->getGuid())
4585 {
4586 const auto previousTarget = getWorldMapUnit(previousTargetGuid);
4587 if (previousTarget != nullptr)
4588 previousTarget->removeAllAurasByIdForGuid(auraHolder->getSpellId(), caster->getGuid());
4589 }
4590 }
4591 }
4592
4593 const auto spellInfo = auraHolder->getSpellInfo();
4594 uint16_t auraSlot = 0xFFFF;
4595
4596 if (!auraHolder->IsPassive())
4597 {
4598 uint16_t startLimit = 0, endLimit = 0;
4599 if (auraHolder->isNegative())
4600 {
4601 startLimit = AuraSlots::NEGATIVE_SLOT_START;
4603 }
4604 else
4605 {
4606 startLimit = AuraSlots::POSITIVE_SLOT_START;
4608 }
4609
4610 auto deleteAur = false;
4611
4612 // Find available slot for new aura
4613 for (auto i = startLimit; i < endLimit; ++i)
4614 {
4615 auto* _aura = m_auraList[i].get();
4616 if (_aura == nullptr)
4617 {
4618 // Found an empty slot
4619 if (auraSlot == 0xFFFF)
4620 auraSlot = i;
4621
4622 // Do not break here, check if unit has any similiar aura
4623 continue;
4624 }
4625
4626 // Check if unit has same aura by same caster or is stackable from multiple casters
4627 if (_aura->getSpellId() == auraHolder->getSpellId())
4628 {
4629 if (_aura->getCasterGuid() != auraHolder->getCasterGuid() &&
4630 !auraHolder->getSpellInfo()->isStackableFromMultipleCasters())
4631 continue;
4632
4633 // The auras are casted by same unit or aura is stackable from multiple units, reapply all effects
4634 // Old aura will never have more effects than new aura and all effects have same indexes
4635 // but old aura can have less effects if certain effects have been removed by i.e. pvp trinket
4636 for (uint8_t x = 0; x < MAX_SPELL_EFFECTS; ++x)
4637 {
4638 _aura->removeAuraEffect(x, true);
4639
4640 // Do not add empty effects
4641 if (auraHolder->getAuraEffect(x)->getAuraEffectType() == SPELL_AURA_NONE)
4642 continue;
4643
4644 _aura->addAuraEffect(auraHolder->getAuraEffect(x), true);
4645 }
4646
4647 // On reapply get duration from new aura
4648 _aura->setOriginalDuration(auraHolder->getOriginalDuration());
4649
4650 // Refresh duration and apply new stack if stackable
4651 _aura->refreshOrModifyStack(false, 1);
4652
4653 deleteAur = true;
4654 break;
4655 }
4656 // If this is a proc spell, it should not remove its mother aura
4657 else if (auraHolder->pSpellId != _aura->getSpellId())
4658 {
4659 // Check for auras by specific type
4660 if (auraHolder->getSpellInfo()->getMaxstack() == 0 && spellInfo->custom_BGR_one_buff_on_target > 0 && auraHolder->getSpellInfo()->custom_BGR_one_buff_on_target & spellInfo->custom_BGR_one_buff_on_target)
4661 {
4662 deleteAur = hasAuraWithSpellType(static_cast<SpellTypes>(spellInfo->getCustom_BGR_one_buff_on_target()), auraHolder->getCasterGuid(), 0);
4663 }
4664 // Check for auras with the same name and a different rank
4665 else
4666 {
4667 AuraCheckResponse checkResponse = auraCheck(spellInfo, _aura, auraHolder->getCaster());
4668 if (checkResponse.Error == AURA_CHECK_RESULT_HIGHER_BUFF_PRESENT)
4669 {
4670 // Existing aura is stronger, delete new aura
4671 deleteAur = true;
4672 break;
4673 }
4674 else if (checkResponse.Error == AURA_CHECK_RESULT_LOWER_BUFF_PRESENT)
4675 {
4676 // Remove the weaker aura
4677 _aura->removeAura();
4678 // Restart search
4679 i = startLimit;
4680 continue;
4681 }
4682 }
4683 }
4684 }
4685
4686 if (deleteAur)
4687 return;
4688 }
4689 else
4690 {
4691 // Passive spells always apply
4692 ///\ todo: probably should add check for passive aura stacking
4694 {
4695 if (m_auraList[i] == nullptr)
4696 {
4697 auraSlot = i;
4698 break;
4699 }
4700 }
4701 }
4702
4703 // Could not find an empty slot, remove aura
4704 if (auraSlot == 0xFFFF)
4705 return;
4706
4707 // Find a visual slot for aura
4708 const auto visualSlot = findVisualSlotForAura(auraHolder.get());
4709
4710 auraHolder->m_visualSlot = visualSlot;
4711 auraHolder->setAuraSlot(auraSlot);
4712
4713 auto* aur = auraHolder.get();
4714 _addAura(std::move(auraHolder));
4715
4716 if (visualSlot < AuraSlots::NEGATIVE_VISUAL_SLOT_END)
4717 {
4718 m_auraVisualList[visualSlot] = aur->getSpellId();
4719
4720#if VERSION_STRING < WotLK
4721 setAura(aur, true);
4722 setAuraFlags(aur, true);
4723 setAuraLevel(aur);
4724 setAuraApplication(aur);
4725#endif
4726
4727 // Send packet
4728 sendAuraUpdate(aur, false);
4729 updateAuraForGroup(visualSlot);
4730 }
4731
4732 aur->applyModifiers(true);
4733 aur->RelocateEvents();
4734 aur->takeUsedSpellModifiers();
4735
4736 // Call scripted aura apply hook
4737 sScriptMgr.callScriptedAuraOnApply(aur);
4738
4739 // Sit down if aura is removed on stand up
4740 //\ todo: move this and aurastates to spellauras.cpp
4741 if (aur->getSpellInfo()->getAuraInterruptFlags() & AURA_INTERRUPT_ON_STAND_UP && !isSitting())
4743
4744 // Hackfix from legacy method
4745 if (aur->getSpellInfo()->getAuraInterruptFlags() & AURA_INTERRUPT_ON_INVINCIBLE)
4746 {
4747 const auto pCaster = aur->GetUnitCaster();
4748 if (pCaster != nullptr)
4749 {
4750 pCaster->removeAllAurasByAuraEffect(SPELL_AURA_MOD_STEALTH);
4751 pCaster->removeAllAurasByAuraEffect(SPELL_AURA_MOD_INVISIBILITY);
4752
4753 uint32_t iceBlock[] =
4754 {
4755 //SPELL_HASH_ICE_BLOCK
4756 27619,
4757 36911,
4758 41590,
4759 45438,
4760 45776,
4761 46604,
4762 46882,
4763 56124,
4764 56644,
4765 62766,
4766 65802,
4767 69924,
4768 0
4769 };
4770 pCaster->removeAllAurasById(iceBlock);
4771
4772 uint32_t divineShield[] =
4773 {
4774 //SPELL_HASH_DIVINE_SHIELD
4775 642,
4776 13874,
4777 29382,
4778 33581,
4779 40733,
4780 41367,
4781 54322,
4782 63148,
4783 66010,
4784 67251,
4785 71550,
4786 0
4787 };
4788 pCaster->removeAllAurasById(divineShield);
4789 //SPELL_HASH_BLESSING_OF_PROTECTION
4790 pCaster->removeAllAurasById(41450);
4791 }
4792 }
4793
4794 // Store target's guid for single target auras
4795 if (aur->getSpellInfo()->getAttributesExE() & ATTRIBUTESEXE_SINGLE_TARGET_AURA)
4796 {
4797 const auto caster = aur->GetUnitCaster();
4798 if (caster != nullptr)
4799 caster->setSingleTargetGuidForAura(aur->getSpellId(), getGuid());
4800 }
4801
4802 // Hackfix from legacy method
4803 if (aur->getSpellInfo()->getMechanicsType() == MECHANIC_ENRAGED && !m_ascEnraged++)
4805 else if (aur->getSpellInfo()->getMechanicsType() == MECHANIC_BLEEDING && !m_ascBleed++)
4807 if (aur->getSpellInfo()->custom_BGR_one_buff_on_target & SPELL_TYPE_SEAL && !m_ascSeal++)
4809
4810}
@ SPELL_AURA_MOD_INVISIBILITY
@ SPELL_AURA_MOD_STEALTH
@ AURA_INTERRUPT_ON_STAND_UP
@ AURA_INTERRUPT_ON_INVINCIBLE
@ AURASTATE_FLAG_JUDGEMENT
@ AURASTATE_FLAG_ENRAGED
@ AURASTATE_FLAG_BLEED
@ SCHOOL_NORMAL
Definition School.hpp:12
#define sScriptMgr
@ ATTRIBUTESEXE_SINGLE_TARGET_AURA
@ ATTRIBUTESEXD_ONLY_IN_OUTLANDS
@ ATTRIBUTESEXG_IGNORE_COLD_WEATHER_FLYING
@ MECHANIC_BLEEDING
@ MECHANIC_ENRAGED
SpellTypes
Definition SpellTypes.hpp:9
@ SPELL_TYPE_SEAL
@ AURA_CHECK_RESULT_HIGHER_BUFF_PRESENT
@ AURA_CHECK_RESULT_LOWER_BUFF_PRESENT
@ STANDSTATE_SIT
Unit * getWorldMapUnit(const uint64_t &guid) const
Definition Object.cpp:4578
uint32_t GetMapId() const
Definition Object.hpp:468
VisualAuraArray m_auraVisualList
Definition Unit.hpp:905
bool isSitting() const
Definition Unit.cpp:7054
uint8_t findVisualSlotForAura(Aura const *aur) const
Definition Unit.cpp:4812
void updateAuraForGroup(uint8_t slot)
Definition Unit.cpp:9396
int8_t m_ascBleed
Definition Unit.hpp:1477
uint32_t m_schoolImmunityList[TOTAL_SPELL_SCHOOLS]
Definition Unit.hpp:1451
void _addAura(std::unique_ptr< Aura > aur)
Definition Unit.cpp:5792
AuraCheckResponse auraCheck(SpellInfo const *spellInfo, Object *caster=nullptr)
Definition Unit.cpp:9672
bool isAlive() const
Definition Unit.cpp:7871
int8_t m_ascEnraged
Definition Unit.hpp:1475
bool hasAuraWithSpellType(SpellTypes type, uint64_t casterGuid=0, uint32_t skipSpellId=0) const
Definition Unit.cpp:5109
int8_t m_ascSeal
Definition Unit.hpp:1476
void sendAuraUpdate(Aura *aur, bool remove)
Definition Unit.cpp:5571
@ PASSIVE_SLOT_END
Definition AuraSlots.hpp:19
@ POSITIVE_SLOT_START
Definition AuraSlots.hpp:21
@ PASSIVE_SLOT_START
Definition AuraSlots.hpp:16
@ POSITIVE_SLOT_END
Definition AuraSlots.hpp:22
@ NEGATIVE_SLOT_START
Definition AuraSlots.hpp:24
@ NEGATIVE_SLOT_END
Definition AuraSlots.hpp:25
@ NEGATIVE_VISUAL_SLOT_END
Definition AuraSlots.hpp:65
G3D::int16 x
uint32_t Error
Definition Unit.hpp:133
unsigned __int64 uint64_t
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addAuraState()

void Unit::addAuraState ( uint32_t  state)

Definition at line 1230 of file Unit.cpp.

1230{ setAuraState(getAuraState() | state); }
uint32_t getAuraState() const
Definition Unit.cpp:1228
void setAuraState(uint32_t state)
Definition Unit.cpp:1229
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addAuraStateAndAuras()

void Unit::addAuraStateAndAuras ( AuraState  state)

Definition at line 5147 of file Unit.cpp.

5148{
5149 if (!(getAuraState() & (1 << (state - 1))))
5150 {
5151 addAuraState(static_cast<uint32_t>(1 << (state - 1)));
5152 if (isPlayer())
5153 {
5154 // Activate passive spells which require this aurastate
5155 const auto player = dynamic_cast<Player*>(this);
5156 for (const auto& spellId : player->getSpellSet())
5157 {
5158 SpellInfo const* spellInfo = sSpellMgr.getSpellInfo(spellId);
5159 if (spellInfo == nullptr || !spellInfo->isPassive())
5160 continue;
5161 if (spellInfo->getCasterAuraState() == static_cast<uint32_t>(state))
5162 castSpell(this, spellId, true);
5163 }
5164 }
5165 }
5166}
#define sSpellMgr
Definition SpellMgr.hpp:197
bool isPassive() const
uint32_t getCasterAuraState() const
SpellCastResult castSpell(uint64_t targetGuid, uint32_t spellId, bool triggered=false)
Definition Unit.cpp:3564
void addAuraState(uint32_t state)
Definition Unit.cpp:1230
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addExtraStrikeTarget()

void Unit::addExtraStrikeTarget ( SpellInfo const spellInfo,
uint32_t  charges 
)

Definition at line 9240 of file Unit.cpp.

9241{
9242 for (auto extraStrikeTarget = m_extraStrikeTargets.begin(); extraStrikeTarget != m_extraStrikeTargets.end(); ++extraStrikeTarget)
9243 {
9244 //a pointer check or id check ...should be the same
9245 if (spellInfo == (*extraStrikeTarget)->spell_info)
9246 {
9247 (*extraStrikeTarget)->charges = charges;
9248 return;
9249 }
9250 }
9251
9252 m_extraStrikeTargets.emplace_back(std::make_unique<ExtraStrike>(spellInfo, charges));
9254}
int32_t m_extraStrikeTargetC
Definition Unit.hpp:1468
Here is the caller graph for this function:

◆ addExtraUnitMovementFlag()

void Unit::addExtraUnitMovementFlag ( uint16_t  f2)

Definition at line 1941 of file Unit.cpp.

1941{ obj_movement_info.flags2 |= f2; }
MovementInfo obj_movement_info
Definition Object.hpp:632

◆ addGameObject()

void Unit::addGameObject ( GameObject gameObj)

Definition at line 8711 of file Unit.cpp.

8712{
8713 if (!gameObj || gameObj->getCreatedByGuid())
8714 return;
8715
8716 m_gameObj.push_back(gameObj);
8717 gameObj->setOwnerGuid(getGuid());
8718}
uint64_t getCreatedByGuid() const
void setOwnerGuid(uint64_t owner)
GameObjectList m_gameObj
Definition Unit.hpp:1111
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addGarbageAura()

void Unit::addGarbageAura ( std::unique_ptr< Aura aur)

Definition at line 8935 of file Unit.cpp.

8936{
8937 m_GarbageAuras.push_back(std::move(aur));
8938}
std::list< std::unique_ptr< Aura > > m_GarbageAuras
Definition Unit.hpp:1243
Here is the caller graph for this function:

◆ addGarbagePet()

void Unit::addGarbagePet ( Pet pet)

Definition at line 8940 of file Unit.cpp.

8941{
8942 if (pet->getPlayerOwner()->getGuid() == getGuid() && !pet->IsInWorld())
8943 m_GarbagePets.push_back(pet);
8944}
bool IsInWorld() const
Definition Object.hpp:98
Player * getPlayerOwner() override
Definition Summon.cpp:352
std::list< Pet * > m_GarbagePets
Definition Unit.hpp:1244
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addHealthBatchEvent()

void Unit::addHealthBatchEvent ( std::unique_ptr< HealthBatchEvent batch)

Definition at line 7406 of file Unit.cpp.

7407{
7408 if (batch == nullptr)
7409 return;
7410
7411 // Do some checks before adding the health event into batch list
7412 if (!isAlive() || !IsInWorld() || m_isInvincible)
7413 return;
7414
7415 if (isPlayer())
7416 {
7417 const auto plr = dynamic_cast<Player*>(this);
7418 if (!batch->isHeal && plr->m_cheats.hasGodModeCheat)
7419 return;
7420 }
7421 else if (isCreature())
7422 {
7423 if (dynamic_cast<Creature*>(this)->isSpiritHealer())
7424 return;
7425 }
7426
7427 m_healthBatch.push_back(std::move(batch));
7428}
bool isSpiritHealer() const
Definition Creature.cpp:265
bool isCreature() const
Definition Object.cpp:570
bool m_isInvincible
Definition Unit.hpp:1500
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addNpcFlags()

void Unit::addNpcFlags ( uint64_t  npcFlags)

Definition at line 1441 of file Unit.cpp.

1441{ setNpcFlags(getNpcFlags() | npcFlags); }
uint64_t getNpcFlags() const
Definition Unit.cpp:1439
void setNpcFlags(uint64_t npcFlags)
Definition Unit.cpp:1440
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addPetFlags()

void Unit::addPetFlags ( uint8_t  petFlags)

Definition at line 1582 of file Unit.cpp.

1582{ setPetFlags(getPetFlags() | petFlags); }
uint8_t getPetFlags() const
Definition Unit.cpp:1580
void setPetFlags(uint8_t petFlags)
Definition Unit.cpp:1581
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addProcTriggerSpell() [1/5]

SpellProc * Unit::addProcTriggerSpell ( SpellInfo const spellInfo,
Aura createdByAura,
uint64_t  casterGuid,
uint32_t const procClassMask = nullptr,
Object obj = nullptr 
)

Definition at line 3723 of file Unit.cpp.

3724{
3725 if (createdByAura == nullptr)
3726 return nullptr;
3727
3728 const auto aurSpellInfo = createdByAura->getSpellInfo();
3729 return addProcTriggerSpell(spellInfo, aurSpellInfo, casterGuid, aurSpellInfo->getProcChance(), static_cast<SpellProcFlags>(aurSpellInfo->getProcFlags()), EXTRA_PROC_NULL, nullptr, procClassMask, createdByAura, obj);
3730}
@ EXTRA_PROC_NULL
Definition ProcFlags.hpp:48
SpellProcFlags
Definition ProcFlags.hpp:11
SpellInfo const * getSpellInfo() const
SpellProc * addProcTriggerSpell(uint32_t spellId, uint32_t originalSpellId, uint64_t casterGuid, uint32_t procChance, SpellProcFlags procFlags, SpellExtraProcFlags exProcFlags, uint32_t const *spellFamilyMask, uint32_t const *procClassMask=nullptr, Aura *createdByAura=nullptr, Object *obj=nullptr)
Definition Unit.cpp:3713
Here is the call graph for this function:

◆ addProcTriggerSpell() [2/5]

SpellProc * Unit::addProcTriggerSpell ( SpellInfo const spellInfo,
SpellInfo const originalSpellInfo,
uint64_t  casterGuid,
uint32_t  procChance,
SpellProcFlags  procFlags,
SpellExtraProcFlags  exProcFlags,
uint32_t const spellFamilyMask,
uint32_t const procClassMask = nullptr,
Aura createdByAura = nullptr,
Object obj = nullptr 
)

Definition at line 3737 of file Unit.cpp.

3738{
3739 SpellProc* spellProc = nullptr;
3740 if (spellInfo != nullptr)
3741 spellProc = getProcTriggerSpell(spellInfo->getId(), casterGuid);
3742
3743 if (spellProc != nullptr && !spellProc->isDeleted())
3744 return spellProc;
3745
3746 // Create new proc since one did not exist
3747 auto spellProcHolder = sSpellProcMgr.newSpellProc(this, spellInfo, originalSpellInfo, casterGuid, procChance, procFlags, exProcFlags, spellFamilyMask, procClassMask, createdByAura, obj);
3748 if (spellProcHolder == nullptr)
3749 {
3750 if (originalSpellInfo != nullptr)
3751 sLogger.failure("Unit::addProcTriggerSpell : Spell id {} tried to add a non-existent spell to Unit {} as SpellProc", originalSpellInfo->getId(), fmt::ptr(this));
3752 else
3753 sLogger.failure("Unit::addProcTriggerSpell : Something tried to add a non-existent spell to Unit {} as SpellProc", fmt::ptr(this));
3754 return nullptr;
3755 }
3756
3757 spellProc = spellProcHolder.get();
3758 m_procSpells.emplace_back(std::move(spellProcHolder));
3759 return spellProc;
3760}
#define sSpellProcMgr
bool isDeleted() const
SpellProc * getProcTriggerSpell(uint32_t spellId, uint64_t casterGuid) const
Definition Unit.cpp:3762
Here is the call graph for this function:

◆ addProcTriggerSpell() [3/5]

SpellProc * Unit::addProcTriggerSpell ( SpellInfo const spellInfo,
SpellInfo const originalSpellInfo,
uint64_t  casterGuid,
uint32_t  procChance,
uint32_t  procFlags,
uint32_t const procClassMask = nullptr,
Aura createdByAura = nullptr,
Object obj = nullptr 
)

Definition at line 3732 of file Unit.cpp.

3733{
3734 return addProcTriggerSpell(spellInfo, originalSpellInfo, casterGuid, procChance, static_cast<SpellProcFlags>(procFlags), EXTRA_PROC_NULL, nullptr, procClassMask, createdByAura, obj);
3735}
Here is the call graph for this function:

◆ addProcTriggerSpell() [4/5]

SpellProc * Unit::addProcTriggerSpell ( SpellInfo const spellInfo,
uint64_t  casterGuid,
Aura createdByAura = nullptr,
uint32_t const procClassMask = nullptr,
Object obj = nullptr 
)

Definition at line 3718 of file Unit.cpp.

3719{
3720 return addProcTriggerSpell(spellInfo, spellInfo, casterGuid, spellInfo->getProcChance(), static_cast<SpellProcFlags>(spellInfo->getProcFlags()), EXTRA_PROC_NULL, nullptr, procClassMask, createdByAura, obj);
3721}
Here is the call graph for this function:

◆ addProcTriggerSpell() [5/5]

SpellProc * Unit::addProcTriggerSpell ( uint32_t  spellId,
uint32_t  originalSpellId,
uint64_t  casterGuid,
uint32_t  procChance,
SpellProcFlags  procFlags,
SpellExtraProcFlags  exProcFlags,
uint32_t const spellFamilyMask,
uint32_t const procClassMask = nullptr,
Aura createdByAura = nullptr,
Object obj = nullptr 
)

Definition at line 3713 of file Unit.cpp.

3714{
3715 return addProcTriggerSpell(sSpellMgr.getSpellInfo(spellId), sSpellMgr.getSpellInfo(originalSpellId), casterGuid, procChance, procFlags, exProcFlags, spellFamilyMask, procClassMask, createdByAura, obj);
3716}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addSimpleDamageBatchEvent()

void Unit::addSimpleDamageBatchEvent ( uint32_t  damage,
Unit attacker = nullptr,
SpellInfo const spellInfo = nullptr 
)

Definition at line 7371 of file Unit.cpp.

7372{
7373 auto batch = std::make_unique<HealthBatchEvent>();
7374 batch->caster = attacker;
7375 batch->damageInfo.realDamage = damage;
7376 batch->spellInfo = spellInfo;
7377
7378 addHealthBatchEvent(std::move(batch));
7379}
void addHealthBatchEvent(std::unique_ptr< HealthBatchEvent > batch)
Definition Unit.cpp:7406
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addSimpleEnvironmentalDamageBatchEvent()

void Unit::addSimpleEnvironmentalDamageBatchEvent ( EnviromentalDamage  type,
uint32_t  damage,
uint32_t  absorbedDamage = 0 
)

Definition at line 7381 of file Unit.cpp.

7382{
7383 auto batch = std::make_unique<HealthBatchEvent>();
7384 batch->damageInfo.realDamage = damage;
7385 batch->isEnvironmentalDamage = true;
7386 batch->environmentType = type;
7387
7388 // Only fire and lava environmental damage types can be absorbed
7389 if (type == DAMAGE_FIRE || type == DAMAGE_LAVA)
7390 batch->damageInfo.absorbedDamage = absorbedDamage;
7391
7392 addHealthBatchEvent(std::move(batch));
7393}
@ DAMAGE_LAVA
@ DAMAGE_FIRE
type
Definition core.h:573
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addSimpleHealingBatchEvent()

void Unit::addSimpleHealingBatchEvent ( uint32_t  heal,
Unit healer = nullptr,
SpellInfo const spellInfo = nullptr 
)

Definition at line 7395 of file Unit.cpp.

7396{
7397 auto batch = std::make_unique<HealthBatchEvent>();
7398 batch->caster = healer;
7399 batch->damageInfo.realDamage = heal;
7400 batch->spellInfo = spellInfo;
7401 batch->isHeal = true;
7402
7403 addHealthBatchEvent(std::move(batch));
7404}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addSpellImmunity()

void Unit::addSpellImmunity ( SpellImmunityMask  immunityMask,
bool  apply 
)

Definition at line 4517 of file Unit.cpp.

4518{
4519 if (apply)
4520 m_spellImmunityMask |= immunityMask;
4521 else
4522 m_spellImmunityMask &= ~immunityMask;
4523}
uint32_t m_spellImmunityMask
Definition Unit.hpp:799
Here is the caller graph for this function:

◆ addSpellModifier()

void Unit::addSpellModifier ( AuraEffectModifier const aurEff,
bool  apply 
)

Definition at line 4411 of file Unit.cpp.

4412{
4413 if (aurEff == nullptr)
4414 return;
4415
4416 const auto aur = aurEff->getAura();
4417 if (isPlayer())
4418 {
4419#if VERSION_STRING >= Cata
4420 std::vector<std::pair<uint8_t, float>> modValues;
4421#endif
4422 const auto isPct = aurEff->getAuraEffectType() == SPELL_AURA_ADD_PCT_MODIFIER;
4423 uint8_t groupNum = 0, intBit = 0;
4424 for (uint8_t bit = 0; bit < SPELL_GROUPS; ++bit, ++intBit)
4425 {
4426 if (intBit == 32)
4427 {
4428 ++groupNum;
4429 intBit = 0;
4430 }
4431
4432 const uint32_t bitMask = 1 << intBit;
4433 if (bitMask & aur->getSpellInfo()->getEffectSpellClassMask(aurEff->getEffectIndex(), groupNum))
4434 {
4435 int32_t totalMod = 0;
4436 for (const auto& mod : m_spellModifiers[aurEff->getEffectMiscValue()])
4437 {
4438 if (mod->getAuraEffectType() != aurEff->getAuraEffectType())
4439 continue;
4440 if (bitMask & mod->getAura()->getSpellInfo()->getEffectSpellClassMask(mod->getEffectIndex(), groupNum))
4441 totalMod += mod->getEffectDamage();
4442 }
4443 totalMod += apply ? aurEff->getEffectDamage() : -aurEff->getEffectDamage();
4444
4445#if VERSION_STRING < Cata
4446 static_cast<Player*>(this)->sendSpellModifierPacket(bit, static_cast<uint8_t>(aurEff->getEffectMiscValue()), totalMod, isPct);
4447#else
4448 modValues.push_back(std::make_pair(bit, static_cast<float>(totalMod)));
4449#endif
4450 }
4451 }
4452
4453#if VERSION_STRING >= Cata
4454 dynamic_cast<Player*>(this)->sendSpellModifierPacket(static_cast<uint8_t>(aurEff->getEffectMiscValue()), modValues, isPct);
4455 modValues.clear();
4456#endif
4457 }
4458
4459 if (apply)
4460 m_spellModifiers[aurEff->getEffectMiscValue()].push_back(aurEff);
4461 else
4462 m_spellModifiers[aurEff->getEffectMiscValue()].remove(aurEff);
4463}
@ SPELL_AURA_ADD_PCT_MODIFIER
#define SPELL_GROUPS
void apply(T *val)
auto mod(T x, int y) -> T
Definition chrono.h:1652
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addStandStateFlags()

void Unit::addStandStateFlags ( uint8_t  standStateFlags)

Definition at line 1392 of file Unit.cpp.

1392{ setStandStateFlags(getStandStateFlags() | standStateFlags); }
void setStandStateFlags(uint8_t standStateFlags)
Definition Unit.cpp:1391
uint8_t getStandStateFlags() const
Definition Unit.cpp:1390
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addToInRangeObjects()

void Unit::addToInRangeObjects ( Object pObj)
virtual

Reimplemented from Object.

Reimplemented in Player, and Creature.

Definition at line 7559 of file Unit.cpp.

7560{
7561 if (pObj->isCreatureOrPlayer())
7562 {
7563 if (this->isHostileTo(pObj))
7565
7566 if (this->isFriendlyTo(pObj))
7568 }
7569
7571}
bool isHostileTo(Object *target)
Definition Object.cpp:4031
virtual void addToInRangeObjects(Object *pObj)
Definition Object.cpp:1541
bool isFriendlyTo(Object *target)
Definition Object.cpp:4047
bool isCreatureOrPlayer() const
Definition Object.cpp:568
void addInRangeOppositeFaction(Object *obj)
Definition Object.cpp:1673
void addInRangeSameFaction(Object *obj)
Definition Object.cpp:1733
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addUnitFlags()

void Unit::addUnitFlags ( uint32_t  unitFlags)

Definition at line 1109 of file Unit.cpp.

1109{ setUnitFlags(getUnitFlags() | unitFlags); }
uint32_t getUnitFlags() const
Definition Unit.cpp:1107
void setUnitFlags(uint32_t unitFlags)
Definition Unit.cpp:1108
Here is the call graph for this function:

◆ addUnitMovementFlag()

void Unit::addUnitMovementFlag ( uint32_t  f)

Definition at line 1935 of file Unit.cpp.

1935{ obj_movement_info.flags |= f; }
Here is the caller graph for this function:

◆ addUnitStateFlag()

void Unit::addUnitStateFlag ( uint32_t  state_flag)
inline

Definition at line 716 of file Unit.hpp.

716{ m_unitState |= state_flag; }
uint32_t m_unitState
Definition Unit.hpp:713
Here is the caller graph for this function:

◆ aggroPvPGuards()

void Unit::aggroPvPGuards ( )

Definition at line 9102 of file Unit.cpp.

9103{
9104 for (const auto& inRangeObject : getInRangeObjectsSet())
9105 {
9106 if (inRangeObject && inRangeObject->isCreature())
9107 {
9108 Unit* inRangeUnit = dynamic_cast<Unit*>(inRangeObject);
9109 if (inRangeUnit->getAIInterface() && inRangeUnit->getAIInterface()->m_isNeutralGuard && CalcDistance(inRangeUnit) <= 50.0f * 50.0f)
9110 inRangeUnit->getAIInterface()->onHostileAction(this);
9111 }
9112 }
9113}
bool m_isNeutralGuard
void onHostileAction(Unit *pUnit, SpellInfo const *spellInfo=nullptr, bool ignoreThreatRedirects=false)
float CalcDistance(Object *Ob)
Definition Object.cpp:3555
std::vector< Object * > getInRangeObjectsSet() const
Definition Object.cpp:1573
AIInterface * getAIInterface() const
Definition Unit.hpp:705
Here is the call graph for this function:

◆ applyControlStatesIfNeeded()

void Unit::applyControlStatesIfNeeded ( )

Definition at line 3423 of file Unit.cpp.

3424{
3425 // Unit States might have been already cleared but auras still present. I need to check with HasAuraType
3427 setStunned(true);
3428
3430 setMoveRoot(true);
3431
3433 setConfused(true);
3434
3436 setFeared(true);
3437}
@ SPELL_AURA_MOD_FEAR
@ SPELL_AURA_MOD_ROOT
@ SPELL_AURA_MOD_CONFUSE
@ SPELL_AURA_MOD_STUN
@ UNIT_STATE_ROOTED
@ UNIT_STATE_CONFUSED
@ UNIT_STATE_FLEEING
@ UNIT_STATE_STUNNED
bool hasUnitStateFlag(uint32_t state_flag) const
Definition Unit.hpp:717
void setStunned(bool apply)
Definition Unit.cpp:3097
void setFeared(bool apply)
Definition Unit.cpp:3034
void setConfused(bool apply)
Definition Unit.cpp:3072
void setMoveRoot(bool set_root)
Definition Unit.cpp:2245
Aura * getAuraWithAuraEffect(AuraEffect aura_effect) const
Definition Unit.cpp:4905
Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyDiminishingReturnTimer()

void Unit::applyDiminishingReturnTimer ( uint32_t duration,
SpellInfo const spell 
)

Definition at line 3447 of file Unit.cpp.

3448{
3449 uint32_t status = sSpellMgr.getDiminishingGroup(spell->getId());
3450 uint32_t group = status & 0xFFFF;
3451 uint32_t PvE = (status >> 16) & 0xFFFF;
3452
3453 // Make sure we have a group
3454 if (group == 0xFFFF)
3455 {
3456 return;
3457 }
3458
3459 // Check if we don't apply to pve
3460 if (!PvE && !isPlayer() && !isPet())
3461 {
3462 return;
3463 }
3464
3465 uint32_t localDuration = *duration;
3467
3468 // Target immune to spell
3469 if (count > 2)
3470 {
3471 *duration = 0;
3472 return;
3473 }
3474
3475 //100%, 50%, 25% bitwise
3476 localDuration >>= count;
3477 if ((isPlayer() || isPet()) && localDuration > uint32_t(10000 >> count))
3478 {
3479 localDuration = 10000 >> count;
3481 {
3482 *duration = localDuration;
3483 return;
3484 }
3485 }
3486
3487 *duration = localDuration;
3488
3489 // Reset the diminishing return counter, and add to the aura count (we don't decrease the timer till we
3490 // have no auras of this type left.
3491 ++m_diminishCount[group];
3492}
@ DIMINISHING_GROUP_NOT_DIMINISHED
virtual bool isPet() const
Definition Object.hpp:203
uint16_t m_diminishCount[DIMINISHING_GROUP_COUNT]
Definition Unit.hpp:1492
constexpr auto count() -> size_t
Definition core.h:1222
Here is the call graph for this function:
Here is the caller graph for this function:

◆ applySpellDamageBonus()

float_t Unit::applySpellDamageBonus ( SpellInfo const spellInfo,
int32_t  baseDmg,
float_t  effectPctModifier = 1.0f,
bool  isPeriodic = false,
Spell castingSpell = nullptr,
Aura aur = nullptr 
)

Definition at line 3913 of file Unit.cpp.

3914{
3915 const auto floatDmg = static_cast<float_t>(baseDmg);
3916 if (spellInfo->getAttributesExC() & ATTRIBUTESEXC_NO_DONE_BONUS)
3917 return floatDmg;
3918
3919 if (spellInfo->custom_c_is_flags & SPELL_FLAG_IS_NOT_USING_DMG_BONUS)
3920 return floatDmg;
3921
3922 // Check if class can benefit from spell power
3923 auto canBenefitFromSpellPower = true;
3924 if (isPlayer())
3925 {
3926 switch (this->getClass())
3927 {
3928 case WARRIOR:
3929#if VERSION_STRING != Classic
3930 // Hunters in classic benefit from spell power
3931 case HUNTER:
3932#endif
3933 case ROGUE:
3934#if VERSION_STRING >= WotLK
3935 case DEATHKNIGHT:
3936#endif
3937 canBenefitFromSpellPower = false;
3938 break;
3939 default:
3940 break;
3941 }
3942 }
3943
3944 float_t bonusDmg = 0.0f, bonusAp = 0.0f;
3945 const auto school = spellInfo->getFirstSchoolFromSchoolMask();
3946
3947 if (canBenefitFromSpellPower)
3948 {
3949 if (aur != nullptr)
3950 bonusDmg = static_cast<float_t>(aur->getSpellPowerBonus());
3951 else
3952 bonusDmg = static_cast<float_t>(GetDamageDoneMod(school));
3953
3954 // Get spell coefficient value
3955 if (bonusDmg > 0.0f)
3956 {
3957 if (!isPeriodic || spellInfo->isChanneled())
3958 {
3959 if (spellInfo->spell_coeff_direct > 0.0f)
3960 bonusDmg *= spellInfo->spell_coeff_direct * effectPctModifier;
3961 else
3962 bonusDmg = 0.0f;
3963 }
3964 else
3965 {
3966 if (spellInfo->spell_coeff_overtime > 0.0f)
3967 bonusDmg *= spellInfo->spell_coeff_overtime * effectPctModifier;
3968 else
3969 bonusDmg = 0.0f;
3970 }
3971
3972 // Apply general downranking penalty
3973 // Level 20 penalty is already applied in SpellMgr::setSpellCoefficient
3974 // This method only existed in late TBC and WotLK, in Cata spells lost their ranks
3975#if VERSION_STRING >= TBC
3976#if VERSION_STRING <= WotLK
3977 /*
3978 If caster level is less than max caster level, then the penalty = 1.0.
3979 If caster level is at or greater than max caster level, then the penalty = (22 + max level - caster level) / 20.
3980 The penalty is capped at 0.
3981 */
3982 const auto maxLevel = spellInfo->getMaxLevel();
3983 if (maxLevel != 0 && isPlayer())
3984 {
3985 float_t penalty = 1.0f;
3986 if (maxLevel <= getLevel())
3987 penalty = (22.0f + maxLevel - getLevel()) / 20.0f;
3988
3989 if (penalty > 1.0f)
3990 penalty = 1.0f;
3991 if (penalty < 0.0f)
3992 penalty = 0.0f;
3993
3994 bonusDmg *= penalty;
3995 }
3996#endif
3997#endif
3998 }
3999
4000 applySpellModifiers(SPELLMOD_PENALTY, &bonusDmg, spellInfo, castingSpell, aur);
4001 }
4002
4003 if (aur != nullptr)
4004 bonusAp = static_cast<float_t>(aur->getAttackPowerBonus());
4005 else
4006 bonusAp = static_cast<float_t>(getAttackPower());
4007
4008 if (bonusAp > 0.0f)
4009 {
4010 // Get attack power bonus
4011 if (isPeriodic || aur != nullptr)
4012 {
4013 if (spellInfo->spell_ap_coeff_overtime > 0.0f)
4014 bonusAp *= spellInfo->spell_ap_coeff_overtime * effectPctModifier;
4015 else
4016 bonusAp = 0.0f;
4017 }
4018 else
4019 {
4020 if (spellInfo->spell_ap_coeff_direct > 0.0f)
4021 bonusAp *= spellInfo->spell_ap_coeff_direct * effectPctModifier;
4022 else
4023 bonusAp = 0.0f;
4024 }
4025 }
4026
4027 bonusDmg += bonusAp;
4028
4029 if (isPeriodic && aur != nullptr)
4030 bonusDmg *= aur->getStackCount();
4031
4032 float_t dmg = floatDmg + std::max(0.0f, bonusDmg);
4033
4034 if (isPeriodic && aur != nullptr)
4035 applySpellModifiers(SPELLMOD_PERIODIC_DAMAGE, &dmg, spellInfo, nullptr, aur);
4036 else if (castingSpell != nullptr)
4037 applySpellModifiers(SPELLMOD_DAMAGE_DONE, &dmg, spellInfo, castingSpell, nullptr);
4038
4039 // Apply pct damage modifiers
4040 dmg *= GetDamageDonePctMod(school);
4041
4042 return dmg;
4043}
@ HUNTER
@ DEATHKNIGHT
@ ROGUE
@ WARRIOR
@ ATTRIBUTESEXC_NO_DONE_BONUS
@ SPELL_FLAG_IS_NOT_USING_DMG_BONUS
@ SPELLMOD_PERIODIC_DAMAGE
@ SPELLMOD_PENALTY
@ SPELLMOD_DAMAGE_DONE
int32_t getSpellPowerBonus() const
uint32_t getAttackPowerBonus() const
uint8_t getStackCount() const
virtual int32_t GetDamageDoneMod(uint16_t)
Definition Unit.hpp:1367
uint8_t getClass() const
Definition Unit.cpp:456
void applySpellModifiers(SpellModifierType modType, T *value, SpellInfo const *spellInfo, Spell *castingSpell=nullptr, Aura *castingAura=nullptr)
Definition Unit.cpp:4465
virtual float GetDamageDonePctMod(uint16_t)
Definition Unit.hpp:1368
uint32_t getAttackPower() const
Definition Unit.cpp:1590
Here is the call graph for this function:
Here is the caller graph for this function:

◆ applySpellHealingBonus()

float_t Unit::applySpellHealingBonus ( SpellInfo const spellInfo,
int32_t  baseHeal,
float_t  effectPctModifier = 1.0f,
bool  isPeriodic = false,
Spell castingSpell = nullptr,
Aura aur = nullptr 
)

Definition at line 3799 of file Unit.cpp.

3800{
3801 const auto floatHeal = static_cast<float_t>(baseHeal);
3802 if (spellInfo->getAttributesExC() & ATTRIBUTESEXC_NO_HEALING_BONUS)
3803 return floatHeal;
3804
3805 // Check for correct class
3806 if (isPlayer())
3807 {
3808 switch (this->getClass())
3809 {
3810 case WARRIOR:
3811#if VERSION_STRING != Classic
3812 // Hunters in classic benefit from spell power
3813 case HUNTER:
3814#endif
3815 case ROGUE:
3816#if VERSION_STRING >= WotLK
3817 case DEATHKNIGHT:
3818#endif
3819 return floatHeal;
3820 default:
3821 break;
3822 }
3823 }
3824
3825 float_t bonusHeal = 0.0f, bonusAp = 0.0f;
3826 const auto school = spellInfo->getFirstSchoolFromSchoolMask();
3827
3828 if (aur != nullptr)
3829 {
3830 bonusHeal = static_cast<float_t>(aur->getHealPowerBonus());
3831 bonusAp = static_cast<float_t>(aur->getAttackPowerBonus());
3832 }
3833 else
3834 {
3835 bonusHeal = static_cast<float_t>(m_healDoneMod[school]);
3836 bonusAp = static_cast<float_t>(getAttackPower());
3837 }
3838
3839 // Get spell coefficient value
3840 if (bonusHeal > 0.0f)
3841 {
3842 if (!isPeriodic || spellInfo->isChanneled())
3843 {
3844 if (spellInfo->spell_coeff_direct > 0.0f)
3845 bonusHeal *= spellInfo->spell_coeff_direct * effectPctModifier;
3846 else
3847 bonusHeal = 0.0f;
3848 }
3849 else
3850 {
3851 if (spellInfo->spell_coeff_overtime > 0.0f)
3852 bonusHeal *= spellInfo->spell_coeff_overtime * effectPctModifier;
3853 else
3854 bonusHeal = 0.0f;
3855 }
3856
3857 // Apply general downranking penalty
3858 // Level 20 penalty is already applied in SpellMgr::setSpellCoefficient
3859 // This method only existed in late TBC and WotLK, in Cata spells lost their ranks
3860#if VERSION_STRING >= TBC
3861#if VERSION_STRING <= WotLK
3862 /*
3863 If caster level is less than max caster level, then the penalty = 1.0.
3864 If caster level is at or greater than max caster level, then the penalty = (22 + max level - caster level) / 20.
3865 The penalty is capped at 0.
3866 */
3867 const auto maxLevel = spellInfo->getMaxLevel();
3868 if (maxLevel != 0 && isPlayer())
3869 {
3870 float_t penalty = 1.0f;
3871 if (maxLevel <= getLevel())
3872 penalty = (22.0f + maxLevel - getLevel()) / 20.0f;
3873
3874 if (penalty > 1.0f)
3875 penalty = 1.0f;
3876 if (penalty < 0.0f)
3877 penalty = 0.0f;
3878
3879 bonusHeal *= penalty;
3880 }
3881#endif
3882#endif
3883 }
3884
3885 if (bonusAp > 0.0f)
3886 {
3887 // Get attack power bonus
3888 if (isPeriodic || aur != nullptr)
3889 bonusAp *= spellInfo->spell_ap_coeff_overtime * effectPctModifier;
3890 else
3891 bonusAp *= spellInfo->spell_ap_coeff_direct * effectPctModifier;
3892 }
3893
3894 applySpellModifiers(SPELLMOD_PENALTY, &bonusHeal, spellInfo, castingSpell, aur);
3895 bonusHeal += bonusAp;
3896
3897 if (isPeriodic && aur != nullptr)
3898 bonusHeal *= aur->getStackCount();
3899
3900 float_t heal = floatHeal + std::max(0.0f, bonusHeal);
3901
3902 if (isPeriodic && aur != nullptr)
3903 applySpellModifiers(SPELLMOD_PERIODIC_DAMAGE, &heal, spellInfo, nullptr, aur);
3904 else if (castingSpell != nullptr)
3905 applySpellModifiers(SPELLMOD_DAMAGE_DONE, &heal, spellInfo, castingSpell, nullptr);
3906
3907 // Apply pct healing modifiers
3908 heal += heal * m_healDonePctMod[school];
3909
3910 return heal;
3911}
@ ATTRIBUTESEXC_NO_HEALING_BONUS
int32_t getHealPowerBonus() const
int32_t m_healDoneMod[TOTAL_SPELL_SCHOOLS]
Definition Unit.hpp:1445
float m_healDonePctMod[TOTAL_SPELL_SCHOOLS]
Definition Unit.hpp:1446
Here is the call graph for this function:
Here is the caller graph for this function:

◆ applySpellModifiers()

template<typename T >
template void Unit::applySpellModifiers< float_t > ( SpellModifierType  modType,
T *  value,
SpellInfo const spellInfo,
Spell castingSpell = nullptr,
Aura castingAura = nullptr 
)

Definition at line 4465 of file Unit.cpp.

4466{
4467 if (spellInfo == nullptr)
4468 return;
4469
4470 int32_t totalPct = 100, totalFlat = 0;
4471 getTotalSpellModifiers(modType, value, &totalFlat, &totalPct, spellInfo, castingSpell, castingAura);
4472
4473 if (totalPct != 100 || totalFlat != 0)
4474 *value = static_cast<T>((*value + totalFlat) * std::max(0, totalPct) / 100);
4475}
void getTotalSpellModifiers(SpellModifierType modType, T baseValue, int32_t *flatMod, int32_t *pctMod, SpellInfo const *spellInfo, Spell *castingSpell=nullptr, Aura *castingAura=nullptr, bool checkOnly=false)
Definition Unit.cpp:4480
Here is the call graph for this function:
Here is the caller graph for this function:

◆ auraActionIf()

bool Unit::auraActionIf ( AuraAction auraAction,
AuraCondition auraCondition 
)

Definition at line 9627 of file Unit.cpp.

9628{
9629 bool done = false;
9630
9632 {
9633 Aura* aura = getAuraWithAuraSlot(i);
9634 if (aura == nullptr)
9635 continue;
9636
9637 if ((*auraCondition)(aura))
9638 {
9639 (*auraAction)(aura);
9640 done = true;
9641 }
9642 }
9643
9644 return done;
9645}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ auraCheck() [1/2]

AuraCheckResponse Unit::auraCheck ( SpellInfo const spellInfo,
Aura aura,
Object caster = nullptr 
)

Definition at line 9730 of file Unit.cpp.

9731{
9732 AuraCheckResponse auraCheckResponse;
9733 SpellInfo const* auraSpellInfo = aura->getSpellInfo();
9734
9735 // no error for now
9736 auraCheckResponse.Error = AURA_CHECK_RESULT_NONE;
9737 auraCheckResponse.Misc = 0;
9738
9739 if (!spellInfo->hasSpellRanks() || !aura->getSpellInfo()->hasSpellRanks())
9740 return auraCheckResponse;
9741
9742 if (spellInfo->getRankInfo()->isSpellPartOfThisSpellRankChain(aura->getSpellId()))
9743 {
9744 // we've got an aura with the same name as the one we're trying to apply
9745 // but first we check if it has the same effects
9746 if ((auraSpellInfo->getEffect(0) == spellInfo->getEffect(0) &&
9747 (auraSpellInfo->getEffect(0) != SPELL_EFFECT_APPLY_AURA || auraSpellInfo->getEffectApplyAuraName(0) == spellInfo->getEffectApplyAuraName(0))) &&
9748 (auraSpellInfo->getEffect(1) == spellInfo->getEffect(1) &&
9749 (auraSpellInfo->getEffect(1) != SPELL_EFFECT_APPLY_AURA || auraSpellInfo->getEffectApplyAuraName(1) == spellInfo->getEffectApplyAuraName(1))) &&
9750 (auraSpellInfo->getEffect(2) == spellInfo->getEffect(2) &&
9751 (auraSpellInfo->getEffect(2) != SPELL_EFFECT_APPLY_AURA || auraSpellInfo->getEffectApplyAuraName(2) == spellInfo->getEffectApplyAuraName(2))))
9752 {
9753 auraCheckResponse.Misc = aura->getSpellInfo()->getId();
9754
9755 // compare the rank to our applying spell
9756 if (aura->getSpellInfo()->getRankInfo()->getRank() > spellInfo->getRankInfo()->getRank())
9757 auraCheckResponse.Error = AURA_CHECK_RESULT_HIGHER_BUFF_PRESENT;
9758 else
9759 auraCheckResponse.Error = AURA_CHECK_RESULT_LOWER_BUFF_PRESENT;
9760 }
9761 }
9762
9763 // return it back to our caller
9764 return auraCheckResponse;
9765}
@ SPELL_EFFECT_APPLY_AURA
@ AURA_CHECK_RESULT_NONE
uint32_t getSpellId() const
bool hasSpellRanks() const
uint32_t getEffectApplyAuraName(uint8_t idx) const
uint32_t getId() const
SpellRankInfo const * getRankInfo() const
uint32_t getEffect(uint8_t idx) const
uint32_t Misc
Definition Unit.hpp:134
uint8_t getRank() const
Definition SpellInfo.cpp:31
Here is the call graph for this function:

◆ auraCheck() [2/2]

AuraCheckResponse Unit::auraCheck ( SpellInfo const spellInfo,
Object caster = nullptr 
)

Definition at line 9672 of file Unit.cpp.

9673{
9674 AuraCheckResponse auraCheckResponse;
9675
9676 // no error for now
9677 auraCheckResponse.Error = AURA_CHECK_RESULT_NONE;
9678 auraCheckResponse.Misc = 0;
9679
9680 if (!spellInfo->hasSpellRanks())
9681 return auraCheckResponse;
9682
9683 // look for spells with same namehash
9685 {
9686 Aura* aura = getAuraWithAuraSlot(x);
9687 if (aura != nullptr)
9688 {
9689 if (!spellInfo->getRankInfo()->isSpellPartOfThisSpellRankChain(aura->getSpellId()))
9690 continue;
9691
9692 // we've got an aura with the same name as the one we're trying to apply
9693 // but first we check if it has the same effects
9694 SpellInfo const* aura_sp = aura->getSpellInfo();
9695
9696 if ((aura_sp->getEffect(0) == spellInfo->getEffect(0) && (aura_sp->getEffect(0) != SPELL_EFFECT_APPLY_AURA ||
9697 aura_sp->getEffectApplyAuraName(0) == spellInfo->getEffectApplyAuraName(0))) &&
9698 (aura_sp->getEffect(1) == spellInfo->getEffect(1) && (aura_sp->getEffect(1) != SPELL_EFFECT_APPLY_AURA ||
9699 aura_sp->getEffectApplyAuraName(1) == spellInfo->getEffectApplyAuraName(1))) &&
9700 (aura_sp->getEffect(2) == spellInfo->getEffect(2) && (aura_sp->getEffect(2) != SPELL_EFFECT_APPLY_AURA ||
9701 aura_sp->getEffectApplyAuraName(2) == spellInfo->getEffectApplyAuraName(2))))
9702 {
9703 auraCheckResponse.Misc = aura->getSpellInfo()->getId();
9704
9705 // compare the rank to our applying spell
9706 if (aura_sp->getRankInfo()->getRank() > spellInfo->getRankInfo()->getRank())
9707 {
9708 if (spellInfo->getEffect(0) == SPELL_EFFECT_TRIGGER_SPELL ||
9709 spellInfo->getEffect(1) == SPELL_EFFECT_TRIGGER_SPELL ||
9710 spellInfo->getEffect(2) == SPELL_EFFECT_TRIGGER_SPELL)
9711 {
9712 auraCheckResponse.Error = AURA_CHECK_RESULT_LOWER_BUFF_PRESENT;
9713 }
9714 else
9715 auraCheckResponse.Error = AURA_CHECK_RESULT_HIGHER_BUFF_PRESENT;
9716 }
9717 else
9718 auraCheckResponse.Error = AURA_CHECK_RESULT_LOWER_BUFF_PRESENT;
9719
9720 // we found something, save some loops and exit
9721 break;
9722 }
9723 }
9724 }
9725 //sLogger.debug("resp = {}", resp.Error);
9726 // return it back to our caller
9727 return auraCheckResponse;
9728}
@ SPELL_EFFECT_TRIGGER_SPELL
Here is the call graph for this function:
Here is the caller graph for this function:

◆ buildMovementPacket() [1/2]

void Unit::buildMovementPacket ( ByteBuffer data)

Definition at line 8801 of file Unit.cpp.

8802{
8803 *data << static_cast<uint32_t>(getUnitMovementFlags()); // movement flags
8804#if VERSION_STRING == TBC
8805 * data << static_cast<uint8_t>(getExtraUnitMovementFlags()); // 2.3.0
8806#elif VERSION_STRING >= WotLK
8807 * data << uint16_t(getExtraUnitMovementFlags()); // 3.x.x
8808#endif
8809 * data << static_cast<uint32_t>(Util::getMSTime()); // time / counter
8810 *data << GetPositionX();
8811 *data << GetPositionY();
8812 *data << GetPositionZ();
8813 *data << GetOrientation();
8814
8815#if VERSION_STRING < Cata
8816 // 0x00000200
8818 {
8819 if (isPlayer())
8820 {
8821 const auto plr = dynamic_cast<Player*>(this);
8822 if (plr->obj_movement_info.hasMovementFlag(MOVEFLAG_TRANSPORT))
8823 {
8824 obj_movement_info.transport_guid = plr->obj_movement_info.transport_guid;
8825 }
8826 }
8827#ifdef FT_VEHICLES
8828 if (Unit* u = getVehicleBase())
8829 obj_movement_info.transport_guid = u->getGuid();
8830#endif
8833 *data << GetTransOffsetX();
8834 *data << GetTransOffsetY();
8835 *data << GetTransOffsetZ();
8836 *data << GetTransOffsetO();
8837 *data << GetTransTime();
8838#ifdef FT_VEHICLES
8839 * data << GetTransSeat();
8840
8841 // TODO what is this in BC?
8843 *data << getMovementInfo()->transport_time2;
8844#endif
8845 }
8846
8847 // 0x02200000
8850 *data << getMovementInfo()->pitch_rate;
8851
8852 *data << getMovementInfo()->fall_time;
8853#endif
8854 // 0x00001000
8855#if VERSION_STRING < Cata
8857 {
8861 *data << getMovementInfo()->jump_info.xyspeed;
8862 }
8863
8864 // 0x04000000
8867#endif
8868}
@ MOVEFLAG_FLYING
@ MOVEFLAG_TRANSPORT
@ MOVEFLAG_SPLINE_ELEVATION
@ MOVEFLAG_FALLING
@ MOVEFLAG_SWIMMING
@ MOVEFLAG2_INTERPOLATED_MOVE
@ MOVEFLAG2_ALLOW_PITCHING
float GetTransOffsetY() const
Definition Object.hpp:382
const float & GetOrientation() const
Definition Object.hpp:357
float GetTransOffsetX() const
Definition Object.hpp:381
uint32_t GetTransTime() const
Definition Object.hpp:385
const float & GetPositionX() const
Definition Object.hpp:354
const float & GetPositionZ() const
Definition Object.hpp:356
float GetTransOffsetZ() const
Definition Object.hpp:383
float GetTransOffsetO() const
Definition Object.hpp:384
const float & GetPositionY() const
Definition Object.hpp:355
MovementInfo * getMovementInfo()
Definition Unit.cpp:1931
bool hasUnitMovementFlag(uint32_t f) const
Definition Unit.cpp:1937
uint16_t getExtraUnitMovementFlags() const
Definition Unit.cpp:1940
uint32_t getUnitMovementFlags() const
Definition Unit.cpp:1933
ObjectGuid transport_guid
uint32_t fall_time
JumpInfo jump_info
uint32_t transport_time2
Here is the call graph for this function:
Here is the caller graph for this function:

◆ buildMovementPacket() [2/2]

void Unit::buildMovementPacket ( ByteBuffer data,
float  x,
float  y,
float  z,
float  o 
)

Definition at line 8871 of file Unit.cpp.

8872{
8873 *data << getUnitMovementFlags(); // movement flags
8874#if VERSION_STRING == TBC
8875 * data << static_cast<uint8_t>(getExtraUnitMovementFlags()); // 2.3.0
8876#elif VERSION_STRING >= WotLK
8877 * data << getExtraUnitMovementFlags(); // 3.x.x
8878#endif
8879 * data << Util::getMSTime(); // time / counter
8880 *data << x;
8881 *data << y;
8882 *data << z;
8883 *data << o;
8884
8885#if VERSION_STRING < Cata
8886 // 0x00000200
8888 {
8890 *data << GetTransOffsetX();
8891 *data << GetTransOffsetY();
8892 *data << GetTransOffsetZ();
8893 *data << GetTransOffsetO();
8894 *data << GetTransTime();
8895#ifdef FT_VEHICLES
8896 * data << GetTransSeat();
8897
8899 *data << getMovementInfo()->transport_time2;
8900#endif
8901 }
8902
8903 // 0x02200000
8906 *data << getMovementInfo()->pitch_rate;
8907
8908 *data << getMovementInfo()->fall_time;
8909#endif
8910 // 0x00001000
8911#if VERSION_STRING < Cata
8913 {
8917 *data << getMovementInfo()->jump_info.xyspeed;
8918 }
8919
8920 // 0x04000000
8923#endif
8924}
G3D::int16 z
G3D::int16 y
Here is the call graph for this function:

◆ calculateDamage()

void Unit::calculateDamage ( )
virtual

Reimplemented in Player.

Definition at line 1910 of file Unit.cpp.

1911{
1912 if (isPet())
1913 dynamic_cast<Pet*>(this)->UpdateAP();
1914
1915 const float ap_bonus = static_cast<float>(getCalculatedAttackPower()) / 14000.0f;
1916
1917 const float bonus = ap_bonus * static_cast<float>(getBaseAttackTime(MELEE) + dynamic_cast<Creature*>(this)->m_speedFromHaste);
1918
1919 const float delta = static_cast<float>(dynamic_cast<Creature*>(this)->ModDamageDone[0]);
1920 const float mult = dynamic_cast<Creature*>(this)->ModDamageDonePct[0];
1921 float r = (m_baseDamage[0] + bonus) * mult + delta;
1922 setMinDamage(r > 0 ? (isPet() ? r * 0.9f : r) : 0);
1923
1924 r = (m_baseDamage[1] + bonus) * mult + delta;
1925 setMaxDamage(r > 0 ? (isPet() ? r * 1.1f : r) : 0);
1926}
@ MELEE
Definition Pet.h:44
float m_baseDamage[2]
Definition Unit.hpp:1390
void setMinDamage(float damage)
Definition Unit.cpp:1282
uint32_t getBaseAttackTime(uint8_t slot) const
Definition Unit.cpp:1233
int32_t getCalculatedAttackPower() const
Definition Unit.cpp:1813
void setMaxDamage(float damage)
Definition Unit.cpp:1285
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculateEstimatedOverHealForCombatLog()

uint32_t Unit::calculateEstimatedOverHealForCombatLog ( uint32_t  heal) const

Definition at line 7456 of file Unit.cpp.

7457{
7458 if (heal == 0 || !isAlive())
7459 return 0;
7460
7461 const auto curHealth = getHealth();
7462 const auto maxHealth = getMaxHealth();
7463 int32_t totalHeal = 0;
7464
7465 for (const auto& batch : m_healthBatch)
7466 {
7467 if (batch->isHeal)
7468 totalHeal += batch->damageInfo.realDamage;
7469 else
7470 totalHeal -= batch->damageInfo.realDamage;
7471 }
7472
7473 const int32_t healthValue = curHealth + totalHeal;
7474 if (healthValue < 0)
7475 return 0;
7476
7477 const auto healthVal = static_cast<uint32_t>(healthValue);
7478 if (healthVal >= maxHealth)
7479 return heal;
7480
7481 const auto healthDiff = maxHealth - healthVal;
7482 if (heal > healthDiff)
7483 return heal - healthDiff;
7484
7485 return 0;
7486}
uint32_t getMaxHealth() const
Definition Unit.cpp:625
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculateEstimatedOverKillForCombatLog()

uint32_t Unit::calculateEstimatedOverKillForCombatLog ( uint32_t  damage) const

Definition at line 7430 of file Unit.cpp.

7431{
7432 if (damage == 0 || !isAlive())
7433 return 0;
7434
7435 const auto curHealth = getHealth();
7436 int32_t totalDamage = 0;
7437
7438 for (const auto& batch : m_healthBatch)
7439 {
7440 if (batch->isHeal)
7441 totalDamage += batch->damageInfo.realDamage;
7442 else
7443 totalDamage -= batch->damageInfo.realDamage;
7444 }
7445
7446 const int32_t healthValue = curHealth + totalDamage;
7447 if (healthValue <= 0)
7448 return damage;
7449
7450 if (damage > static_cast<uint32_t>(healthValue))
7451 return damage - healthValue;
7452
7453 return 0;
7454}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculateResistanceReduction()

void Unit::calculateResistanceReduction ( Unit unitVictim,
DamageInfo damageInfo,
SpellInfo const spellInfoAbility,
float  armorPctReduce 
)

Definition at line 9513 of file Unit.cpp.

9514{
9515 float averageResistance = 0.0f;
9516
9517 if ((*damageInfo).schoolMask == SCHOOL_MASK_NORMAL)
9518 {
9519 float armorReduction;
9520
9521#if VERSION_STRING > TBC
9522 if (this->isPlayer())
9523 armorReduction = m_powerCostPctMod[0] + ((float)unitVictim->getResistance(0) * (armorPctReduce + static_cast<Player*>(this)->calcRating(CR_ARMOR_PENETRATION)) / 100.0f);
9524 else
9525 armorReduction = 0.0f;
9526#else
9527 if (this->isPlayer())
9528 armorReduction = m_powerCostPctMod[0];
9529 else
9530 armorReduction = 0.0f;
9531#endif
9532
9533 if (armorReduction >= unitVictim->getResistance(0))
9534 return;
9535
9536 double levelReduction = 0;
9537 if (getLevel() < 60)
9538 levelReduction = static_cast<double>(unitVictim->getResistance(0) - armorReduction) / static_cast<double>(unitVictim->getResistance(0) + 400 + (85 * getLevel()));
9539 else if (getLevel() > 59 && getLevel() < DBC_PLAYER_LEVEL_CAP)
9540 levelReduction = static_cast<double>(unitVictim->getResistance(0) - armorReduction) / static_cast<double>(unitVictim->getResistance(0) - 22167.5 + (467.5 * getLevel()));
9541 else
9542 levelReduction = static_cast<double>(unitVictim->getResistance(0) - armorReduction) / static_cast<double>(unitVictim->getResistance(0) + 10557.5);
9543
9544 if (levelReduction > 0.75f)
9545 levelReduction = 0.75f;
9546 else if (levelReduction < 0)
9547 levelReduction = 0;
9548
9549 if (levelReduction)
9550 (*damageInfo).fullDamage = static_cast<uint32_t>((*damageInfo).fullDamage * (1 - levelReduction)); // no multiply by 0
9551 }
9552 else
9553 {
9554 // applying resistance to other type of damage
9555 int32_t schoolResistance = Util::float2int32((unitVictim->getResistance((*damageInfo).getSchoolTypeFromMask()) + ((unitVictim->getLevel() > getLevel()) ? (unitVictim->getLevel() - this->getLevel()) * 5 : 0)) - m_powerCostPctMod[(*damageInfo).getSchoolTypeFromMask()]);
9556 if (schoolResistance < 0)
9557 schoolResistance = 0;
9558
9559 averageResistance = (static_cast<float>(schoolResistance) / static_cast<float>(getLevel() * 5) * 0.75f);
9560 if (averageResistance > 0.75f)
9561 averageResistance = 0.75f;
9562
9563 // NOT WOWWIKILIKE but i think it's actually to add some fullresist chance from resistances
9564 if (!spellInfoAbility || !(spellInfoAbility->getAttributes() & ATTRIBUTES_IGNORE_INVULNERABILITY))
9565 {
9566 float resistChance = static_cast<float>(unitVictim->getResistance((*damageInfo).getSchoolTypeFromMask())) / static_cast<float>(unitVictim->getLevel());
9567 resistChance *= resistChance;
9568 if (Util::checkChance(resistChance))
9569 averageResistance = 1.0f;
9570 }
9571
9572 if (averageResistance > 0)
9573 (*damageInfo).resistedDamage = static_cast<uint32_t>(((*damageInfo).fullDamage) * averageResistance);
9574 else
9575 (*damageInfo).resistedDamage = 0;
9576 }
9577}
@ CR_ARMOR_PENETRATION
#define DBC_PLAYER_LEVEL_CAP
@ SCHOOL_MASK_NORMAL
Definition School.hpp:25
@ ATTRIBUTES_IGNORE_INVULNERABILITY
uint32_t getResistance(uint8_t type) const
Definition Unit.cpp:1459
float m_powerCostPctMod[TOTAL_SPELL_SCHOOLS]
Definition Unit.hpp:1454
Here is the call graph for this function:
Here is the caller graph for this function:

◆ canBeginCombat()

bool Unit::canBeginCombat ( Unit target)

Definition at line 1873 of file Unit.cpp.

1874{
1875 if (this == target)
1876 return false;
1877
1878 // ...the two units need to be in the world
1879 if (!IsInWorld() || !target->IsInWorld())
1880 return false;
1881 // ...the two units need to both be alive
1882 if (!isAlive() || !target->isAlive())
1883 return false;
1884 // ...the two units need to be on the same map
1885 if (getWorldMap() != target->getWorldMap())
1886 return false;
1887 // ...the two units need to be in the same phase
1888 if (GetPhase() != target->GetPhase())
1889 return false;
1891 return false;
1893 return false;
1894 // ... both units must not be ignoring combat
1895 if (getAIInterface()->isCombatDisabled() || target->getAIInterface()->isCombatDisabled())
1896 return false;
1897 if (isFriendlyTo(target) || target->isFriendlyTo(this))
1898 return false;
1899
1900 Player* playerA = getUnitOwnerOrSelf() ? getUnitOwnerOrSelf()->ToPlayer() : nullptr;
1901 Player* playerB = target->getUnitOwnerOrSelf() ? target->getUnitOwnerOrSelf()->ToPlayer() : nullptr;
1902
1903 // ...neither of the two units must be (owned by) a player with .gm on
1904 if ((playerA && playerA->isGMFlagSet()) || (playerB && playerB->isGMFlagSet()))
1905 return false;
1906
1907 return true;
1908}
@ UNIT_STATE_EVADING
@ UNIT_STATE_IN_FLIGHT
bool isCombatDisabled()
Player * ToPlayer()
Definition Object.hpp:391
virtual Unit * getUnitOwnerOrSelf()
Definition Object.cpp:1749
uint32_t GetPhase() const
Definition Object.hpp:636
bool isGMFlagSet() const
Definition Player.cpp:9381
Here is the call graph for this function:
Here is the caller graph for this function:

◆ canDualWield()

bool Unit::canDualWield ( ) const

Definition at line 3537 of file Unit.cpp.

3538{
3539 return m_canDualWield;
3540}
bool m_canDualWield
Definition Unit.hpp:793
Here is the caller graph for this function:

◆ canFly()

bool Unit::canFly ( )
virtual

Reimplemented in Creature.

Definition at line 2993 of file Unit.cpp.

2994{
2995 return false;
2996}
Here is the caller graph for this function:

◆ canReachWithAttack()

bool Unit::canReachWithAttack ( Unit unitTarget)

Definition at line 1831 of file Unit.cpp.

1832{
1833 if (GetMapId() != unitTarget->GetMapId())
1834 return false;
1835
1836 float selfreach = getCombatReach();
1837 if (isPlayer())
1838 selfreach = 5.0f;
1839
1840 float targetradius = unitTarget->getModelHalfSize();
1841 float selfradius = getModelHalfSize();
1842
1843 const float delta_x = unitTarget->GetPositionX() - GetPositionX();
1844 const float delta_y = unitTarget->GetPositionY() - GetPositionY();
1845 const float distance = std::sqrt(delta_x * delta_x + delta_y * delta_y);
1846
1847 float attackreach = targetradius + selfreach + selfradius;
1848
1849 if (isPlayer())
1850 {
1851 if (unitTarget->isPlayer() && dynamic_cast<Player*>(unitTarget)->isMoving())
1852 {
1853 uint32_t latency = dynamic_cast<Player*>(unitTarget)->getSession() ? dynamic_cast<Player*>(unitTarget)->getSession()->GetLatency() : 0;
1854
1855 latency = latency > 500 ? 500 : latency;
1856
1857 attackreach += getSpeedRate(TYPE_RUN, true) * 0.001f * static_cast<float>(latency);
1858 }
1859
1860 if (dynamic_cast<Player*>(this)->isMoving())
1861 {
1862 uint32_t latency = dynamic_cast<Player*>(this)->getSession() ? dynamic_cast<Player*>(this)->getSession()->GetLatency() : 0;
1863
1864 latency = latency > 500 ? 500 : latency;
1865
1866 attackreach += getSpeedRate(TYPE_RUN, true) * 0.001f * static_cast<float>(latency);
1867 }
1868 }
1869
1870 return (distance <= attackreach);
1871}
@ TYPE_RUN
bool isMoving() const
Definition Player.cpp:1510
float getCombatReach() const
Definition Unit.cpp:1249
float getSpeedRate(UnitSpeedType type, bool current) const
Definition Unit.cpp:2549
float getModelHalfSize() const
Definition Unit.hpp:1510
double distance(double x, double y)
Definition g3dmath.h:731
Here is the call graph for this function:
Here is the caller graph for this function:

◆ canSee()

bool Unit::canSee ( Object *const  obj)

Definition at line 5845 of file Unit.cpp.

5846{
5847 if (obj == nullptr)
5848 return false;
5849
5850 if (this == obj)
5851 return true;
5852
5853 if (!IsInWorld() || !obj->IsInWorld() || GetMapId() != obj->GetMapId())
5854 return false;
5855
5856 // Unit cannot see objects from different phases
5857 if ((GetPhase() & obj->GetPhase()) == 0)
5858 return false;
5859
5860 // Get map view distance (WIP: usually 100 yards for open world and 500 yards for instanced maps)
5861 //\ todo: there are some objects which should be visible even further and some objects which should always be visible
5862 // should cover all Instances with 5000 * 5000 easyier for far Gameobjects / Creatures to Handle, also Loaded Cells affect the Distance standart 2 Cells equal 500.0f * 500.0f : aaron02
5863 const auto viewDistance = getWorldMap()->getBaseMap()->isInstanceMap() ? 5000.0f * 5000.0f : getWorldMap()->getVisibilityRange();
5864 if (obj->isGameObject())
5865 {
5866 // TODO: for now, all maps have 500 yard view distance
5867 // problem is that objects on active map cells are updated only if player can see it, iirc
5868
5869 // Transports and Destructible Buildings should always be visible
5870 const auto gobj = dynamic_cast<GameObject*>(obj);
5871 if (gobj->getGoType() == GAMEOBJECT_TYPE_TRANSPORT || gobj->getGoType() == GAMEOBJECT_TYPE_MO_TRANSPORT || gobj->getGoType() == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING)
5872 {
5873 return true;
5874 }
5875 else
5876 {
5877 if (!isInRange(gobj->GetPosition(), viewDistance))
5878 return false;
5879 }
5880 }
5881 else
5882 {
5883 if (!isInRange(obj->GetPosition(), viewDistance))
5884 return false;
5885 }
5886
5887 // Unit cannot see invisible Game Masters unless he/she has Game Master flag on
5888 if (obj->isPlayer() && dynamic_cast<Player*>(obj)->m_isGmInvisible)
5889 return isPlayer() && dynamic_cast<Player*>(this)->hasPlayerFlags(PLAYER_FLAG_GM);
5890
5891 uint64_t ownerGuid = 0;
5892 if (getCharmedByGuid() != 0)
5893 ownerGuid = getCharmedByGuid();
5894 else
5895 ownerGuid = getSummonedByGuid();
5896
5897 // Unit can always see its master
5898 if (ownerGuid == obj->getGuid())
5899 return true;
5900
5901 // Player is dead and has released spirit
5902 if (isPlayer() && getDeathState() == CORPSE)
5903 {
5904 // Player should see all default spawned gameobjects when dead
5905 if (obj->isGameObject() && obj->getPlayerOwner() == nullptr)
5906 return true;
5907
5908 const float_t corpseViewDistance = 1600.0f; // 40*40 yards
5909 const auto playerMe = dynamic_cast<Player*>(this);
5910 // If object is another player
5911 if (obj->isPlayer())
5912 {
5913 // Dead player can see all players in arena regardless of range
5914 if (playerMe->m_deathVision)
5915 return true;
5916
5917 // Player can see all friendly and unfriendly players within 40 yards from his/her corpse
5918 const auto playerObj = dynamic_cast<Player*>(obj);
5919 if (playerMe->getCorpseInstanceId() == playerMe->GetInstanceID() &&
5920 playerObj->isInRange(playerMe->getCorpseLocation(), corpseViewDistance))
5921 return true;
5922
5923 // Otherwise player can only see other players who have released their spirits as well
5924 return playerObj->getDeathState() == CORPSE;
5925 }
5926
5927 // Dead player can also see all objects in arena regardless of range
5928 if (playerMe->m_deathVision)
5929 return true;
5930
5931 if (playerMe->getCorpseInstanceId() == GetInstanceID())
5932 {
5933 // Player can see his/her own corpse
5934 if (obj->isCorpse() && dynamic_cast<Corpse*>(obj)->getOwnerGuid() == getGuid())
5935 return true;
5936
5937 // Player can see all objects within 40 yards from his/her own corpse
5938 if (obj->isInRange(playerMe->getCorpseLocation(), corpseViewDistance))
5939 return true;
5940 }
5941
5942 // Player can see Spirit Healers
5943 if (obj->isCreature() && dynamic_cast<Creature*>(obj)->isSpiritHealer())
5944 return true;
5945
5946 return false;
5947 }
5948
5949 // Unit is alive or player hasn't released spirit yet
5950 // Do checks based on object's type
5951 switch (obj->getObjectTypeId())
5952 {
5953 case TYPEID_PLAYER:
5954 {
5955 const auto playerObj = dynamic_cast<Player*>(obj);
5956 if (playerObj->getDeathState() == CORPSE)
5957 {
5958 if (isPlayer())
5959 {
5960 // If players are from same group, they can see each other normally
5961 const auto playerMe = dynamic_cast<Player*>(this);
5962 if (playerMe->getGroup() && playerMe->getGroup() == playerObj->getGroup())
5963 return true;
5964
5965 // Game Masters can see all dead players
5966 return dynamic_cast<Player*>(this)->hasPlayerFlags(PLAYER_FLAG_GM);
5967 }
5968 else
5969 {
5970 // Non-player units cannot see dead players
5971 return false;
5972 }
5973 }
5974 } break;
5975 case TYPEID_UNIT:
5976 {
5977 // Unit cannot see Spirit Healers when unit's alive
5978 // unless unit is a Game Master
5979 if (obj->isCreature() && dynamic_cast<Creature*>(obj)->isSpiritHealer())
5980 return isPlayer() && dynamic_cast<Player*>(this)->hasPlayerFlags(PLAYER_FLAG_GM);
5981
5982 const auto unitObj = dynamic_cast<Unit*>(obj);
5983
5984 if (unitObj->getCharmedByGuid() != 0)
5985 ownerGuid = unitObj->getCharmedByGuid();
5986 else
5987 ownerGuid = unitObj->getSummonedByGuid();
5988
5989 // Unit can always see their own summoned units
5990 if (getGuid() == ownerGuid)
5991 return true;
5992
5993 if (isPlayer())
5994 {
5995 // Group members can see each other's summoned units
5996 // unless they are dueling, then it's based on detection
5997 const auto objectOwner = getWorldMapPlayer(ownerGuid);
5998 if (objectOwner != nullptr)
5999 {
6000 if (objectOwner->getGroup() && objectOwner->getGroup()->HasMember(dynamic_cast<Player*>(this)))
6001 {
6002 if (objectOwner->getDuelPlayer() != dynamic_cast<Player*>(this))
6003 return true;
6004 }
6005 }
6006
6007 // If object is only visible to either faction
6008 if (unitObj->getAIInterface()->faction_visibility == 1)
6009 return dynamic_cast<Player*>(this)->isTeamHorde() ? true : false;
6010 if (unitObj->getAIInterface()->faction_visibility == 2)
6011 return dynamic_cast<Player*>(this)->isTeamHorde() ? false : true;
6012 }
6013 } break;
6014 case TYPEID_GAMEOBJECT:
6015 {
6016 const auto gameObjectObj = dynamic_cast<GameObject*>(obj);
6017 // Stealthed / invisible gameobjects
6018 if (gameObjectObj->inStealth || gameObjectObj->invisible)
6019 {
6020 ownerGuid = gameObjectObj->getCreatedByGuid();
6021 // Unit can always see their own created gameobjects
6022 if (getGuid() == ownerGuid)
6023 return true;
6024
6025 // Group members can see each other's created gameobjects
6026 // unless they are dueling, then it's based on detection
6027 const auto objectOwner = getWorldMapPlayer(ownerGuid);
6028 if (objectOwner != nullptr && isPlayer())
6029 {
6030 if (objectOwner->getGroup() && objectOwner->getGroup()->HasMember(dynamic_cast<Player*>(this)))
6031 {
6032 if (objectOwner->getDuelPlayer() != dynamic_cast<Player*>(this))
6033 return true;
6034 }
6035 }
6036 }
6037 } break;
6038 default:
6039 break;
6040 }
6041
6042 // Game Masters can see invisible and stealthed objects
6043 if (isPlayer() && dynamic_cast<Player*>(this)->hasPlayerFlags(PLAYER_FLAG_GM))
6044 return true;
6045
6046 // Hunter Marked units are always visible to caster
6047 if (obj->isCreatureOrPlayer() && dynamic_cast<Unit*>(obj)->m_stalkedByGuid == getGuid())
6048 return true;
6049
6050 // Pets and summoned units don't have detection, they rely on their master's detection
6051 auto meUnit = this;
6052 if (getCharmedByGuid() != 0)
6053 {
6054 const auto summoner = getWorldMapUnit(getCharmedByGuid());
6055 if (summoner != nullptr)
6056 meUnit = summoner;
6057 }
6058 else if (getSummonedByGuid() != 0)
6059 {
6060 const auto summoner = getWorldMapUnit(getSummonedByGuid());
6061 if (summoner != nullptr)
6062 meUnit = summoner;
6063 }
6064
6065 const auto unitTarget = dynamic_cast<Unit*>(obj);
6066 const auto gobTarget = dynamic_cast<GameObject*>(obj);
6067
6068 ////////////////////////////
6069 // Invisibility detection
6070
6071 if (obj->isCreatureOrPlayer())
6072 {
6073 // Players should never see these types of invisible units
6074 // Creatures need to be able to see them so invisible triggers can cast spells on visible targets
6075 if (meUnit->isPlayer() && unitTarget->getInvisibilityLevel(INVIS_FLAG_NEVER_VISIBLE) > 0)
6076 return false;
6077 }
6078
6079 for (uint8_t i = 0; i < INVIS_FLAG_TOTAL; ++i)
6080 {
6081 if (i == INVIS_FLAG_NEVER_VISIBLE)
6082 continue;
6083
6084 auto unitInvisibilityValue = meUnit->getInvisibilityLevel(InvisibilityFlag(i));
6085 auto unitInvisibilityDetection = meUnit->getInvisibilityDetection(InvisibilityFlag(i));
6086 auto objectInvisibilityValue = 0;
6087 auto objectInvisibilityDetection = 0;
6088
6089 if (obj->isCreatureOrPlayer())
6090 {
6091 objectInvisibilityValue = unitTarget->getInvisibilityLevel(InvisibilityFlag(i));
6092 objectInvisibilityDetection = unitTarget->getInvisibilityDetection(InvisibilityFlag(i));
6093
6094 // When unit is invisible, unit can only see those objects which have enough detection value
6095 if ((unitInvisibilityValue > objectInvisibilityDetection) ||
6096 // When object is invisible, unit can only see it if unit has enough detection value
6097 (objectInvisibilityValue > unitInvisibilityDetection))
6098 return false;
6099 }
6100 else if (obj->isGameObject() && gobTarget->invisible && i == INVIS_FLAG_TRAP)
6101 {
6102 // Base value for invisible traps seems to be 300 according to spell id 2836
6103 objectInvisibilityValue = 300;
6104 if (objectInvisibilityValue > unitInvisibilityDetection)
6105 return false;
6106 }
6107 }
6108
6109 ////////////////////////////
6110 // Stealth detection
6111
6112 if ((obj->isCreatureOrPlayer() && unitTarget->isStealthed()) || (obj->isGameObject() && gobTarget->inStealth))
6113 {
6114 // Get absolute distance
6115 const auto distance = meUnit->CalcDistance(obj);
6116 const auto combatReach = meUnit->getCombatReach();
6117 if (obj->isCreatureOrPlayer())
6118 {
6119#if VERSION_STRING >= TBC
6120 // Shadow Sight buff in arena makes unit detect stealth regardless of distance and facing
6121 if (meUnit->hasAuraWithAuraEffect(SPELL_AURA_DETECT_STEALTH))
6122 return true;
6123#endif
6124
6125 // Normally units not in front cannot be detected
6126 if (!meUnit->isInFront(obj))
6127 return false;
6128
6129 // If object is closer than unit's combat reach
6130 if (distance < combatReach)
6131 return true;
6132 }
6133
6134 // Objects outside of Line of Sight cannot be detected
6135 if (worldConfig.terrainCollision.isCollisionEnabled)
6136 {
6137 if (!meUnit->IsWithinLOSInMap(obj))
6138 return false;
6139 }
6140
6141 // In unit cases base stealth level and base stealth detection increases by 5 points per unit's level
6142 // Stealth detection base points start from 30ish, exact value unknown
6143 int detectionValue = 30 + meUnit->getLevel() * 5;
6144
6145 // Apply modifiers which increases unit's stealth detection
6146 if (obj->isCreatureOrPlayer())
6147 detectionValue += meUnit->getStealthDetection(STEALTH_FLAG_NORMAL);
6148 else if (obj->isGameObject())
6149 detectionValue += meUnit->getStealthDetection(STEALTH_FLAG_TRAP);
6150
6151 // Subtract object's stealth level from detection value
6152 if (obj->isCreatureOrPlayer())
6153 detectionValue -= unitTarget->getStealthLevel(STEALTH_FLAG_NORMAL);
6154 else if (obj->isGameObject())
6155 {
6156 // Base value for stealthed gameobjects seems to be 70 according to spell id 2836
6157 detectionValue -= 70;
6158 if (gobTarget->getCreatedByGuid() != 0)
6159 {
6160 // If trap has an owner, subtract owner's stealth level (unit level * 5) from detection value
6161 const auto summoner = gobTarget->getWorldMapUnit(gobTarget->getCreatedByGuid());
6162 if (summoner != nullptr)
6163 detectionValue -= summoner->getLevel() * 5;
6164 }
6165 else
6166 // If trap has no owner, subtract trap's level from detection value
6167 detectionValue -= gobTarget->GetGameObjectProperties()->trap.level * 5;
6168 }
6169
6170 auto visibilityRange = detectionValue * 0.3f + combatReach;
6171 if (visibilityRange <= 0.0f)
6172 return false;
6173
6174 // Players cannot see stealthed objects from further than 30 yards
6175 if (meUnit->isPlayer() && visibilityRange > 30.0f)
6176 visibilityRange = 30.0f;
6177
6178 // Object is further than unit's visibility range
6179 if (distance > visibilityRange)
6180 return false;
6181 }
6182 return true;
6183}
@ SPELL_AURA_DETECT_STEALTH
@ GAMEOBJECT_TYPE_MO_TRANSPORT
@ GAMEOBJECT_TYPE_TRANSPORT
@ GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING
@ TYPEID_GAMEOBJECT
@ TYPEID_UNIT
@ TYPEID_PLAYER
@ PLAYER_FLAG_GM
#define true
Definition StormPort.h:32
#define false
Definition StormPort.h:33
@ STEALTH_FLAG_TRAP
@ STEALTH_FLAG_NORMAL
InvisibilityFlag
@ INVIS_FLAG_TOTAL
@ INVIS_FLAG_NEVER_VISIBLE
@ INVIS_FLAG_TRAP
@ CORPSE
bool isInstanceMap() const
Definition BaseMap.cpp:117
LocationVector GetPosition() const
Definition Object.hpp:373
int32_t GetInstanceID()
Definition Object.hpp:664
virtual Player * getPlayerOwner()
Definition Object.cpp:1751
Player * getWorldMapPlayer(const uint64_t &guid) const
Definition Object.cpp:4586
bool isCorpse() const
Definition Object.cpp:573
bool isGameObject() const
Definition Object.cpp:572
uint8_t getObjectTypeId() const
Definition Object.cpp:566
bool isInRange(LocationVector location, float square_r) const
Definition Object.cpp:578
bool isTeamHorde() const
Definition Player.cpp:2787
uint64_t m_stalkedByGuid
Definition Unit.hpp:1407
uint64_t getCharmedByGuid() const
Definition Unit.cpp:391
uint64_t getSummonedByGuid() const
Definition Unit.cpp:394
DeathState getDeathState() const
Definition Unit.cpp:7924
float getVisibilityRange() const
Definition WorldMap.hpp:181
BaseMap * getBaseMap() const
Definition WorldMap.hpp:320
Here is the call graph for this function:
Here is the caller graph for this function:

◆ canSwim()

bool Unit::canSwim ( )
virtual

Reimplemented in Creature.

Definition at line 1114 of file Unit.cpp.

1115{
1116 // Mirror client behavior, if this method returns false then client will not use swimming animation and for players will apply gravity as if there was no water
1118 return false;
1119 if (hasUnitFlags(UNIT_FLAG_PVP_ATTACKABLE)) // is player
1120 return true;
1121#if VERSION_STRING >= TBC
1122 if (hasUnitFlags2(UNIT_FLAG_PLAYER_CONTROLLED_CREATURE))
1123 return false;
1124#endif
1126 return true;
1127#if VERSION_STRING == Classic
1129#else
1130 return hasUnitFlags(UNIT_FLAG_UNKNOWN_5 | UNIT_FLAG_SWIMMING);
1131#endif
1132}
@ UNIT_FLAG_SWIMMING
@ UNIT_FLAG_PVP_ATTACKABLE
@ UNIT_FLAG_PLAYER_CONTROLLED_CREATURE
@ UNIT_FLAG_DEAD
@ UNIT_FLAG_PET_IN_COMBAT
bool hasUnitFlags(uint32_t unitFlags) const
Definition Unit.cpp:1111
Here is the call graph for this function:
Here is the caller graph for this function:

◆ castOnMeleeSpell()

void Unit::castOnMeleeSpell ( )

Definition at line 9383 of file Unit.cpp.

9384{
9385 const auto spellInfo = sSpellMgr.getSpellInfo(getOnMeleeSpell());
9386
9387 if (Spell* spell = sSpellMgr.newSpell(this, spellInfo, true, nullptr))
9388 {
9389 spell->extra_cast_number = getOnMeleeSpellEcn();
9391 spell->prepare(&targets);
9392 setOnMeleeSpell(0);
9393 }
9394}
uint64_t getTargetGuid() const
Definition Unit.cpp:400
void setOnMeleeSpell(uint32_t spellId, uint8_t ecn=0)
Definition Unit.hpp:1333
uint32_t getOnMeleeSpell() const
Definition Unit.hpp:1334
uint8_t getOnMeleeSpellEcn() const
Definition Unit.hpp:1335
Here is the call graph for this function:
Here is the caller graph for this function:

◆ castSpell() [1/11]

SpellCastResult Unit::castSpell ( SpellCastTargets  targets,
SpellInfo const spellInfo,
bool  triggered = false 
)

Definition at line 3640 of file Unit.cpp.

3641{
3642 if (spellInfo == nullptr)
3643 return SPELL_FAILED_UNKNOWN;
3644
3645 Spell* newSpell = sSpellMgr.newSpell(this, spellInfo, triggered, nullptr);
3646 return newSpell->prepare(&targets);
3647}
@ SPELL_FAILED_UNKNOWN
SpellCastResult prepare(SpellCastTargets *targets)
Definition Spell.cpp:255
Here is the call graph for this function:

◆ castSpell() [2/11]

SpellCastResult Unit::castSpell ( SpellCastTargets  targets,
uint32_t  spellId,
bool  triggered = false 
)

Definition at line 3634 of file Unit.cpp.

3635{
3636 const auto spellInfo = sSpellMgr.getSpellInfo(spellId);
3637 return castSpell(targets, spellInfo, triggered);
3638}
Here is the call graph for this function:

◆ castSpell() [3/11]

SpellCastResult Unit::castSpell ( uint64_t  targetGuid,
SpellInfo const spellInfo,
bool  triggered = false 
)

Definition at line 3576 of file Unit.cpp.

3577{
3578 if (spellInfo == nullptr)
3579 return SPELL_FAILED_UNKNOWN;
3580
3581 const SpellForcedBasePoints forcedBasePoints;
3582 return castSpell(targetGuid, spellInfo, forcedBasePoints, triggered);
3583}
Here is the call graph for this function:

◆ castSpell() [4/11]

SpellCastResult Unit::castSpell ( uint64_t  targetGuid,
SpellInfo const spellInfo,
SpellForcedBasePoints  forcedBasepoints,
bool  triggered 
)

Definition at line 3678 of file Unit.cpp.

3679{
3680 if (spellInfo == nullptr)
3681 return SPELL_FAILED_UNKNOWN;
3682
3683 Spell* newSpell = sSpellMgr.newSpell(this, spellInfo, triggered, nullptr);
3684 newSpell->forced_basepoints = std::make_shared<SpellForcedBasePoints>(forcedBasepoints);
3685
3686 SpellCastTargets targets(targetGuid);
3687
3688 // Prepare the spell
3689 return newSpell->prepare(&targets);
3690}
std::shared_ptr< SpellForcedBasePoints > forced_basepoints
Definition Spell.hpp:245
Here is the call graph for this function:

◆ castSpell() [5/11]

SpellCastResult Unit::castSpell ( uint64_t  targetGuid,
uint32_t  spellId,
bool  triggered = false 
)

Definition at line 3564 of file Unit.cpp.

3565{
3566 const SpellForcedBasePoints forcedBasePoints;
3567 return castSpell(targetGuid, spellId, forcedBasePoints, triggered);
3568}
Here is the call graph for this function:

◆ castSpell() [6/11]

SpellCastResult Unit::castSpell ( uint64_t  targetGuid,
uint32_t  spellId,
SpellForcedBasePoints  forcedBasepoints,
bool  triggered = false 
)

Definition at line 3594 of file Unit.cpp.

3595{
3596 const auto spellInfo = sSpellMgr.getSpellInfo(spellId);
3597 if (spellInfo == nullptr)
3598 return SPELL_FAILED_UNKNOWN;
3599
3600 return castSpell(targetGuid, spellInfo, forcedBasepoints, triggered);
3601}
Here is the call graph for this function:

◆ castSpell() [7/11]

SpellCastResult Unit::castSpell ( Unit target,
SpellInfo const spellInfo,
bool  triggered = false 
)

Definition at line 3585 of file Unit.cpp.

3586{
3587 if (spellInfo == nullptr)
3588 return SPELL_FAILED_UNKNOWN;
3589
3590 const SpellForcedBasePoints forcedBasePoints;
3591 return castSpell(target, spellInfo, forcedBasePoints, triggered);
3592}
Here is the call graph for this function:

◆ castSpell() [8/11]

SpellCastResult Unit::castSpell ( Unit target,
SpellInfo const spellInfo,
SpellForcedBasePoints  forcedBasepoints,
bool  triggered 
)

Definition at line 3692 of file Unit.cpp.

3693{
3694 if (spellInfo == nullptr)
3695 return SPELL_FAILED_UNKNOWN;
3696
3697 Spell* newSpell = sSpellMgr.newSpell(this, spellInfo, triggered, nullptr);
3698 newSpell->forced_basepoints = std::make_shared<SpellForcedBasePoints>(forcedBasepoints);
3699
3700 SpellCastTargets targets(0);
3701 if (target != nullptr)
3702 {
3703 targets.addTargetMask(TARGET_FLAG_UNIT);
3704 targets.setUnitTarget(target->getGuid());
3705 }
3706 else
3707 newSpell->GenerateTargets(&targets);
3708
3709 // Prepare the spell
3710 return newSpell->prepare(&targets);
3711}
@ TARGET_FLAG_UNIT
bool GenerateTargets(SpellCastTargets *store_buff)
Here is the call graph for this function:

◆ castSpell() [9/11]

SpellCastResult Unit::castSpell ( Unit target,
SpellInfo const spellInfo,
SpellForcedBasePoints  forcedBasePoints,
int32_t  spellCharges,
bool  triggered = false 
)

Definition at line 3612 of file Unit.cpp.

3613{
3614 if (spellInfo == nullptr)
3615 return SPELL_FAILED_UNKNOWN;
3616
3617 Spell* newSpell = sSpellMgr.newSpell(this, spellInfo, triggered, nullptr);
3618 newSpell->forced_basepoints = std::make_shared<SpellForcedBasePoints>(forcedBasePoints);
3619 newSpell->m_charges = spellCharges;
3620
3621 SpellCastTargets targets(0);
3622 if (target != nullptr)
3623 {
3624 targets.addTargetMask(TARGET_FLAG_UNIT);
3625 targets.setUnitTarget(target->getGuid());
3626 }
3627 else
3628 newSpell->GenerateTargets(&targets);
3629
3630 // Prepare the spell
3631 return newSpell->prepare(&targets);
3632}
int32_t m_charges
Definition Spell.hpp:681
Here is the call graph for this function:

◆ castSpell() [10/11]

SpellCastResult Unit::castSpell ( Unit target,
uint32_t  spellId,
bool  triggered = false 
)

Definition at line 3570 of file Unit.cpp.

3571{
3572 const SpellForcedBasePoints forcedBasePoints;
3573 return castSpell(target, spellId, forcedBasePoints, triggered);
3574}
Here is the call graph for this function:

◆ castSpell() [11/11]

SpellCastResult Unit::castSpell ( Unit target,
uint32_t  spellId,
SpellForcedBasePoints  forcedBasePoints,
bool  triggered = false 
)

Definition at line 3603 of file Unit.cpp.

3604{
3605 const auto spellInfo = sSpellMgr.getSpellInfo(spellId);
3606 if (spellInfo == nullptr)
3607 return SPELL_FAILED_UNKNOWN;
3608
3609 return castSpell(target, spellInfo, forcedBasepoints, triggered);
3610}
Here is the call graph for this function:

◆ castSpellLoc() [1/2]

SpellCastResult Unit::castSpellLoc ( const LocationVector  location,
SpellInfo const spellInfo,
bool  triggered = false 
)

Definition at line 3655 of file Unit.cpp.

3656{
3657 if (spellInfo == nullptr)
3658 return SPELL_FAILED_UNKNOWN;
3659
3660 SpellCastTargets targets;
3661 targets.setDestination(location);
3663
3664 // Prepare the spell
3665 Spell* newSpell = sSpellMgr.newSpell(this, spellInfo, triggered, nullptr);
3666 return newSpell->prepare(&targets);
3667}
@ TARGET_FLAG_DEST_LOCATION
void setDestination(LocationVector destination)
void setTargetMask(uint32_t mask)
Here is the call graph for this function:

◆ castSpellLoc() [2/2]

SpellCastResult Unit::castSpellLoc ( const LocationVector  location,
uint32_t  spellId,
bool  triggered = false 
)

Definition at line 3649 of file Unit.cpp.

3650{
3651 const auto spellInfo = sSpellMgr.getSpellInfo(spellId);
3652 return castSpellLoc(location, spellInfo, triggered);
3653}
SpellCastResult castSpellLoc(const LocationVector location, uint32_t spellId, bool triggered=false)
Definition Unit.cpp:3649
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearAllAreaAuraTargets()

void Unit::clearAllAreaAuraTargets ( )

Definition at line 5532 of file Unit.cpp.

5533{
5534 for (const auto& aur : getAuraList())
5535 {
5536 // Aura is area aura but it was not casted by this unit
5537 if (aur == nullptr || aur->m_areaAura)
5538 continue;
5539
5540 if (aur->IsAreaAura())
5541 aur->ClearAATargets();
5542 }
5543}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearCasterFromHealthBatch()

void Unit::clearCasterFromHealthBatch ( Unit const caster)

Definition at line 7500 of file Unit.cpp.

7501{
7502 for (auto& itr : m_healthBatch)
7503 {
7504 if (itr->caster == caster)
7505 itr->caster = nullptr;
7506 }
7507}
Here is the caller graph for this function:

◆ clearHateList()

void Unit::clearHateList ( )

Definition at line 8085 of file Unit.cpp.

8086{
8088}
Here is the call graph for this function:

◆ clearHealthBatch()

void Unit::clearHealthBatch ( )

Definition at line 7488 of file Unit.cpp.

7489{
7490 m_healthBatch.clear();
7491
7492 // This function is also called on unit death so make sure to remove health based aurastates
7495#if VERSION_STRING >= WotLK
7497#endif
7498}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearInRangeSets()

void Unit::clearInRangeSets ( )
virtual

Reimplemented from Object.

Definition at line 7585 of file Unit.cpp.

7586{
7588}
virtual void clearInRangeSets()
Definition Object.cpp:1531
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearProcCooldowns()

void Unit::clearProcCooldowns ( )

Definition at line 3791 of file Unit.cpp.

3792{
3793 for (auto& proc : m_procSpells)
3794 {
3795 proc->setLastTriggerTime(0);
3796 }
3797}
Here is the caller graph for this function:

◆ createChatPacket()

std::unique_ptr< WorldPacket > Unit::createChatPacket ( uint8_t  type,
uint32_t  language,
std::string  msg,
Unit receiver = nullptr,
uint32_t  sessionLanguage = 0 
)

Definition at line 6804 of file Unit.cpp.

6805{
6806 // Note: target is not the one who receives the message
6807 // it is whom the message should be pointed at
6808 // for example in text $N would get replaced by target's name
6809 // and $R would get replaced by target's race
6810 std::string senderName = "", targetName = "";
6811 uint64_t targetGuid = 0;
6812
6813 // Get sender's name
6814 if (isPlayer())
6815 {
6816 senderName = dynamic_cast<Player*>(this)->getName();
6817 }
6818 else
6819 {
6820 const auto creature = dynamic_cast<Creature*>(this);
6821 const auto localizedName = (sessionLanguage > 0) ? sMySQLStore.getLocalizedCreature(creature->getEntry(), sessionLanguage) : nullptr;
6822 if (localizedName != nullptr)
6823 senderName = localizedName->name;
6824 else
6825 senderName = creature->GetCreatureProperties()->Name;
6826 }
6827
6828 // Get target's name
6829 if (target != nullptr)
6830 {
6831 targetGuid = target->getGuid();
6832
6833 if (target->isPlayer())
6834 {
6835 targetName = dynamic_cast<Player*>(target)->getName();
6836 }
6837 else
6838 {
6839 const auto creature = dynamic_cast<Creature*>(target);
6840 auto* const localizedName = (sessionLanguage > 0) ? sMySQLStore.getLocalizedCreature(creature->getEntry(), sessionLanguage) : nullptr;
6841 if (localizedName != nullptr)
6842 targetName = localizedName->name;
6843 else
6844 targetName = creature->GetCreatureProperties()->Name;
6845 }
6846 }
6847
6848 return SmsgMessageChat(type, language, 0, msg, getGuid(), senderName, targetGuid, targetName).serialise();
6849}
#define sMySQLStore
virtual std::unique_ptr< WorldPacket > serialise()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deactivate()

void Unit::deactivate ( WorldMap mgr)
virtual

Reimplemented from Object.

Definition at line 9058 of file Unit.cpp.

9059{
9060 if (m_useAI)
9062
9064 Object::deactivate(mgr);
9065}
void enterEvadeMode()
virtual void deactivate(WorldMap *mgr)
Definition Object.cpp:4386
bool m_useAI
Definition Unit.hpp:701
CombatHandler & getCombatHandler()
Definition Unit.cpp:1803
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dealDamage()

void Unit::dealDamage ( Unit victim,
uint32_t  damage,
uint32_t  spellId,
bool  removeAuras = true 
)

\ todo: fix this, currently used for root and fear auras

\ todo: fix this, currently used for root and fear auras

Definition at line 7089 of file Unit.cpp.

7090{
7091 // Not accepted cases
7092 if (victim == nullptr || !victim->isAlive() || !victim->IsInWorld() || !IsInWorld())
7093 return;
7094 if (victim->isPlayer() && dynamic_cast<Player*>(victim)->m_cheats.hasGodModeCheat)
7095 return;
7096 if (victim->m_isInvincible)
7097 return;
7098 if (victim->isCreature() && dynamic_cast<Creature*>(victim)->isSpiritHealer())
7099 return;
7100
7101 if (this != victim)
7102 {
7103 if (isPlayer())
7104 {
7105 const auto plr = dynamic_cast<Player*>(this);
7106 if (!plr->getSession()->hasPermissions() && worldConfig.limit.isLimitSystemEnabled != 0)
7107 damage = plr->checkDamageLimits(damage, spellId);
7108 }
7109
7110 const auto plrOwner = getPlayerOwnerOrSelf();
7111 if (plrOwner != nullptr)
7112 {
7113 // Battleground damage score
7114 if (plrOwner->getBattleground() && getWorldMap() == victim->getWorldMap())
7115 {
7116 plrOwner->m_bgScore.DamageDone += damage;
7117 plrOwner->getBattleground()->updatePvPData();
7118 }
7119 }
7120
7121 // Make victim's pets react to attacker
7123 }
7124
7126
7127 // Tagging should happen when damage packets are sent
7128 const auto plrOwner = getPlayerOwnerOrSelf();
7129 if (plrOwner != nullptr && victim->isCreature() && victim->isTaggableFor(this))
7130 {
7131 victim->setTaggerGuid(this);
7132 plrOwner->tagUnit(victim);
7133 }
7134
7135 if (removeAuras)
7136 {
7137 // Check for auras which are interrupted on damage taken
7138 // But do not remove the aura created by this spell
7139 if (spellId != 0)
7140 {
7142 ///\ todo: fix this, currently used for root and fear auras
7143 if (Util::checkChance(35.0f))
7145 }
7146 else
7147 {
7149 ///\ todo: fix this, currently used for root and fear auras
7150 if (Util::checkChance(35.0f))
7152 }
7153 }
7154
7155 victim->takeDamage(this, damage, spellId);
7156}
virtual Player * getPlayerOwnerOrSelf()
Definition Object.cpp:1753
PlayerCheat m_cheats
Definition Player.hpp:1090
void notifyOnOwnerAttacked(Unit *attacker)
void setTaggerGuid(Unit const *tagger)
Definition Unit.cpp:8103
SummonHandler * getSummonInterface()
Definition Unit.cpp:7943
bool isTaggableFor(Unit const *unit) const
Definition Unit.cpp:8130
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deMorph()

void Unit::deMorph ( )

Definition at line 8792 of file Unit.cpp.

8793{
8794 uint32_t displayid = this->getNativeDisplayId();
8795 this->setDisplayId(displayid);
8797}
void eventModelChange()
Definition Unit.cpp:9091
void setDisplayId(uint32_t id)
Definition Unit.cpp:1253
uint32_t getNativeDisplayId() const
Definition Unit.cpp:1275
Here is the call graph for this function:
Here is the caller graph for this function:

◆ die()

void Unit::die ( Unit pAttacker,
uint32_t  damage,
uint32_t  spellid 
)
virtual

Reimplemented in Pet, Creature, Summon, and Player.

Definition at line 374 of file Unit.cpp.

375{}
Here is the caller graph for this function:

◆ disableSpline()

void Unit::disableSpline ( )

Definition at line 3281 of file Unit.cpp.

3282{
3283#if VERSION_STRING >= Cata
3285#else
3287#endif
3288
3289 movespline->_Interrupt();
3290}
MovementFlags
@ MOVEFLAG_MOVE_FORWARD
@ MOVEFLAG_SPLINE_FORWARD_ENABLED
void removeMovementFlag(MovementFlags _flags)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dismount()

void Unit::dismount ( bool  resummonPet = true)

Definition at line 8602 of file Unit.cpp.

8603{
8604 if (!isMounted())
8605 return;
8606
8607#if VERSION_STRING == Classic
8608 // TODO
8609#else
8611 removeUnitFlags(UNIT_FLAG_MOUNT);
8612
8613 if (Player* player = ToPlayer())
8614 {
8615 ByteBuffer guidData;
8616 guidData << GetNewGUID();
8617 WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, guidData.size() + 4 + 4);
8618 data.append(guidData);
8619 data << uint32_t(Util::getTimeNow()); // Packet counter
8620 data << getCollisionHeight();
8621 sendPacket(&data);
8622
8623 if (player->getMountSpellId() != 0)
8624 {
8625 removeAllAurasById(player->getMountSpellId());
8626 player->setMountSpellId(0);
8627 }
8628
8629 //if we had pet then respawn
8630 if (resummonPet)
8631 player->summonTemporarilyUnsummonedPet();
8632 }
8633
8634 WorldPacket data(SMSG_DISMOUNT, 8);
8635 data << GetNewGUID();
8636 sendMessageToSet(&data, true);
8637
8638#if VERSION_STRING >= WotLK
8639 // dismount as a vehicle
8640 if (isPlayer() && getVehicleKit())
8641 {
8642 // Send other players that we are no longer a vehicle
8643 sendMessageToSet(SmsgPlayerVehicleData().serialise().get(), true);
8644 // Remove vehicle from player
8645 removeVehicleKit();
8646 }
8647#endif
8648
8650
8651 // if we have charmed npc, remove stun also
8652 if (Unit* charm = getWorldMapUnit(getCharmGuid()))
8653 if (charm->isCreature() && charm->hasUnitFlags(UNIT_FLAG_STUNNED) && !charm->hasUnitStateFlag(UNIT_STATE_STUNNED))
8654 charm->removeUnitFlags(UNIT_FLAG_STUNNED);
8655#endif
8656}
@ AURA_INTERRUPT_ON_DISMOUNT
@ SMSG_MOVE_SET_COLLISION_HGT
Definition Opcodes.hpp:1435
@ SMSG_DISMOUNT
Definition Opcodes.hpp:1022
@ UNIT_FLAG_STUNNED
size_t size() const
Definition ByteBuffer.h:505
const WoWGuid & GetNewGUID() const
Definition Object.hpp:335
virtual void sendPacket(WorldPacket *)
Definition Object.hpp:598
virtual void sendMessageToSet(WorldPacket *data, bool self, bool myteam_only=false)
Definition Object.cpp:4490
float getCollisionHeight() const override
Definition Unit.cpp:8659
void removeUnitFlags(uint32_t unitFlags)
Definition Unit.cpp:1110
void setMountDisplayId(uint32_t id)
Definition Unit.cpp:1279
uint64_t getCharmGuid() const
Definition Unit.cpp:380
void removeAllAurasById(uint32_t auraId, AuraRemoveMode mode=AURA_REMOVE_BY_SERVER)
Definition Unit.cpp:5248
bool isMounted() const
Definition Unit.cpp:8541
time_t getTimeNow()
Definition Util.cpp:135
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doDamageSplitTarget()

uint32_t Unit::doDamageSplitTarget ( uint32_t  res,
SchoolMask  schoolMask,
bool  isMeleeDmg 
)

Definition at line 9256 of file Unit.cpp.

9257{
9258 Unit* splittarget = (getWorldMap() != nullptr) ? getWorldMap()->getUnit(m_damageSplitTarget->m_target) : nullptr;
9259 if (splittarget != nullptr && res > 0)
9260 {
9261 // calculate damage
9262 uint32_t tmpsplit = m_damageSplitTarget->m_flatDamageSplit;
9263 if (tmpsplit > res)
9264 tmpsplit = res;
9265
9266 uint32_t splitdamage = tmpsplit;
9267 res -= tmpsplit;
9268 tmpsplit = Util::float2int32(m_damageSplitTarget->m_pctDamageSplit * res);
9269 if (tmpsplit > res)
9270 tmpsplit = res;
9271
9272 splitdamage += tmpsplit;
9273 res -= tmpsplit;
9274
9275 if (splitdamage)
9276 {
9277 splittarget->dealDamage(splittarget, splitdamage, 0);
9278
9279 if (isMeleeDmg)
9280 {
9281 DamageInfo damageInfo;
9282 damageInfo.fullDamage = splitdamage;
9283 damageInfo.schoolMask = schoolMask;
9284 sendAttackerStateUpdate(GetNewGUID(), splittarget->GetNewGUID(), HITSTATUS_NORMALSWING, splitdamage, 0, damageInfo, 0, VisualState::ATTACK, 0, 0);
9285 }
9286 else
9287 {
9288 uint32_t overKill = 0;
9289 if (splitdamage > splittarget->getHealth())
9290 overKill = splitdamage - splittarget->getHealth();
9291
9292 splittarget->sendSpellNonMeleeDamageLog(this, splittarget, sSpellMgr.getSpellInfo(m_damageSplitTarget->m_spellId), splitdamage, 0, 0, 0, overKill, false, false);
9293 }
9294 }
9295 }
9296
9297 return res;
9298}
@ HITSTATUS_NORMALSWING
void dealDamage(Unit *victim, uint32_t damage, uint32_t spellId, bool removeAuras=true)
Definition Unit.cpp:7089
void sendSpellNonMeleeDamageLog(Object *caster, Object *target, SpellInfo const *spellInfo, uint32_t damage, uint32_t absorbedDamage, uint32_t resistedDamage, uint32_t blockedDamage, uint32_t overKill, bool isPeriodicDamage, bool isCriticalHit)
Definition Unit.cpp:4232
void sendAttackerStateUpdate(const WoWGuid &attackerGuid, const WoWGuid &victimGuid, HitStatus hitStatus, uint32_t damage, uint32_t overKill, DamageInfo damageInfo, uint32_t absorbedDamage, VisualState visualState, uint32_t blockedDamage, uint32_t rageGain)
Definition Unit.cpp:4355
Unit * getUnit(const uint64_t &guid)
int32_t fullDamage
SchoolMask schoolMask
Here is the call graph for this function:
Here is the caller graph for this function:

◆ emote()

void Unit::emote ( EmoteType  emote)

Definition at line 7063 of file Unit.cpp.

7064{
7065
7066#if VERSION_STRING < Cata
7067 if (emote == 0)
7068 return;
7069#endif
7070
7071 sendMessageToSet(SmsgEmote(emote, this->getGuid()).serialise().get(), true);
7072}
void emote(EmoteType emote)
Definition Unit.cpp:7063
Here is the call graph for this function:

◆ emoteExpire()

void Unit::emoteExpire ( )

Definition at line 7081 of file Unit.cpp.

7082{
7084 sEventMgr.RemoveEvents(this, EVENT_UNIT_EMOTE);
7085}
@ EVENT_UNIT_EMOTE
Definition EventMgr.h:38
#define sEventMgr
Definition EventMgr.h:278
void setEmoteState(uint32_t id)
Definition Unit.cpp:1446
uint32_t m_oldEmote
Definition Unit.hpp:1107
Here is the call graph for this function:
Here is the caller graph for this function:

◆ energize()

void Unit::energize ( Unit target,
uint32_t  spellId,
uint32_t  amount,
PowerType  type,
bool  sendPacket = true 
)

Definition at line 6680 of file Unit.cpp.

6681{
6682 if (target == nullptr || spellId == 0 || amount == 0)
6683 return;
6684
6685 // Send packet first
6686 if (sendPacket)
6687 sendSpellEnergizeLog(target, spellId, amount, type);
6688
6689 // Send either SMSG_SPELLENERGIZELOG or SMSG_POWER_UPDATE packet, not both
6690 target->setPower(type, target->getPower(type) + amount, !sendPacket);
6691
6692#if VERSION_STRING >= Cata
6693 // Reset Holy Power timer back to 10 seconds
6694 if (isPlayer() && type == POWER_TYPE_HOLY_POWER)
6695 dynamic_cast<Player*>(this)->resetHolyPowerTimer();
6696#endif
6697}
@ POWER_TYPE_HOLY_POWER
Definition PowerType.hpp:29
void setPower(PowerType type, uint32_t value, bool sendPacket=true, bool skipObjectUpdate=false)
Definition Unit.cpp:547
void sendSpellEnergizeLog(Unit *target, uint32_t spellId, uint32_t amount, PowerType type)
Definition Unit.cpp:6699
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventAddEmote()

void Unit::eventAddEmote ( EmoteType  emote,
uint32_t  time 
)

Definition at line 7074 of file Unit.cpp.

7075{
7079}
@ EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT
Definition EventMgr.h:109
void emoteExpire()
Definition Unit.cpp:7081
uint32_t getEmoteState() const
Definition Unit.cpp:1445
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventCastSpell()

void Unit::eventCastSpell ( Unit target,
SpellInfo const spellInfo 
)

Definition at line 3669 of file Unit.cpp.

3670{
3671 const SpellForcedBasePoints forcedBasePoints;
3672 if (spellInfo != nullptr)
3673 castSpell(target, spellInfo, forcedBasePoints, true);
3674 else
3675 sLogger.failure("Unit::eventCastSpell tried to cast invalid spell with no spellInfo (nullptr)");
3676}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventChill()

void Unit::eventChill ( Unit unitProcTarget,
bool  isVictim = false 
)

Definition at line 9185 of file Unit.cpp.

9186{
9187 if (this == unitProcTarget)
9188 return;
9189
9190 int32_t t_trigger_on_chill;
9191 int32_t t_trigger_on_chill_chance;
9192
9193 if (isVictim == false)
9194 {
9195 t_trigger_on_chill = static_cast<int32_t>(m_triggerOnChill);
9196 t_trigger_on_chill_chance = static_cast<int32_t>(m_triggerOnChillChance);
9197 }
9198 else
9199 {
9200 t_trigger_on_chill = static_cast<int32_t>(m_triggerOnChillVictim);
9201 t_trigger_on_chill_chance = static_cast<int32_t>(m_triggerOnChillChanceVictim);
9202 }
9203
9204 if (t_trigger_on_chill)
9205 {
9206 if (t_trigger_on_chill_chance < 100 && !Util::checkChance(t_trigger_on_chill_chance))
9207 return;
9208
9209 const auto spellInfo = sSpellMgr.getSpellInfo(t_trigger_on_chill);
9210 if (!spellInfo)
9211 return;
9212
9213 if (Spell* spell = sSpellMgr.newSpell(this, spellInfo, true, nullptr))
9214 {
9215 SpellCastTargets targets;
9216
9217 if (unitProcTarget)
9218 targets.setUnitTarget(unitProcTarget->getGuid());
9219 else
9220 targets.setUnitTarget(getGuid());
9221
9222 spell->prepare(&targets);
9223 }
9224 }
9225}
void setUnitTarget(uint64_t guid)
uint32_t m_triggerOnChillChanceVictim
Definition Unit.hpp:1268
uint32_t m_triggerOnChill
Definition Unit.hpp:1265
uint32_t m_triggerOnChillChance
Definition Unit.hpp:1266
uint32_t m_triggerOnChillVictim
Definition Unit.hpp:1267
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventModelChange()

void Unit::eventModelChange ( )

Definition at line 9091 of file Unit.cpp.

9092{
9093 MySQLStructure::DisplayBoundingBoxes const* displayBoundingBox = sMySQLStore.getDisplayBounding(getDisplayId());
9094
9095 //\todo if has mount, grab mount model and add the z value of attachment 0
9096 if (displayBoundingBox != nullptr)
9097 m_modelHalfSize = displayBoundingBox->high[2] / 2;
9098 else
9099 m_modelHalfSize = 1.0f;
9100}
float m_modelHalfSize
Definition Unit.hpp:1513
uint32_t getDisplayId() const
Definition Unit.cpp:1252
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventRemoveAura()

void Unit::eventRemoveAura ( uint32_t  spellId)
inline

Definition at line 848 of file Unit.hpp.

848{ removeAllAurasById(spellId); }

◆ eventStunOrImmobilize()

void Unit::eventStunOrImmobilize ( Unit unitProcTarget,
bool  isVictim = false 
)

Definition at line 9129 of file Unit.cpp.

9130{
9131 if (this == unitProcTarget)
9132 return;
9133
9134 int32_t t_trigger_on_stun;
9135 int32_t t_trigger_on_stun_chance;
9136
9137 if (isVictim == false)
9138 {
9139 t_trigger_on_stun = static_cast<int32_t>(m_triggerOnStun);
9140 t_trigger_on_stun_chance = static_cast<int32_t>(m_triggerOnStunChance);
9141 }
9142 else
9143 {
9144 t_trigger_on_stun = static_cast<int32_t>(m_triggerOnStunVictim);
9145 t_trigger_on_stun_chance = static_cast<int32_t>(m_triggerOnStunChanceVictim);
9146 }
9147
9148 if (t_trigger_on_stun)
9149 {
9150 if (t_trigger_on_stun_chance < 100 && !Util::checkChance(t_trigger_on_stun_chance))
9151 return;
9152
9153 const auto spellInfo = sSpellMgr.getSpellInfo(t_trigger_on_stun);
9154 if (!spellInfo)
9155 return;
9156
9157 if (Spell* spell = sSpellMgr.newSpell(this, spellInfo, true, nullptr))
9158 {
9159 SpellCastTargets targets;
9160
9161 if (unitProcTarget)
9162 targets.setUnitTarget(unitProcTarget->getGuid());
9163 else
9164 targets.setUnitTarget(getGuid());
9165
9166 spell->prepare(&targets);
9167 }
9168 }
9169}
uint32_t m_triggerOnStunVictim
Definition Unit.hpp:1258
uint32_t m_triggerOnStun
Definition Unit.hpp:1256
uint32_t m_triggerOnStunChance
Definition Unit.hpp:1257
uint32_t m_triggerOnStunChanceVictim
Definition Unit.hpp:1259
Here is the call graph for this function:
Here is the caller graph for this function:

◆ findVisualSlotForAura()

uint8_t Unit::findVisualSlotForAura ( Aura const aur) const

Definition at line 4812 of file Unit.cpp.

4813{
4814 uint8_t visualSlot = 0xFF;
4815#if VERSION_STRING < WotLK
4816 // Pre wotlk do not send self casted passive area auras
4817 if (aur->IsPassive())
4818#else
4819 // Since wotlk send all passive area auras
4820 if (aur->IsPassive() && !aur->IsAreaAura() && !aur->hasAuraEffect(SPELL_AURA_IGNORE_TARGET_AURA_STATE))
4821#endif
4822 return visualSlot;
4823
4824 uint8_t start, end;
4825 if (!aur->isNegative())
4826 {
4829 }
4830 else
4831 {
4834 }
4835
4836 // Find an empty slot
4837 for (auto i = start; i < end; ++i)
4838 {
4839 if (m_auraVisualList[i] == 0)
4840 {
4841 visualSlot = i;
4842 break;
4843 }
4844 }
4845
4846 return visualSlot;
4847}
@ SPELL_AURA_IGNORE_TARGET_AURA_STATE
@ POSITIVE_VISUAL_SLOT_START
Definition AuraSlots.hpp:58
@ NEGATIVE_VISUAL_SLOT_START
Definition AuraSlots.hpp:64
@ POSITIVE_VISUAL_SLOT_END
Definition AuraSlots.hpp:60
Here is the call graph for this function:
Here is the caller graph for this function:

◆ followerAdded()

void Unit::followerAdded ( AbstractFollower f)
inline

Definition at line 650 of file Unit.hpp.

650{ m_followingMe.insert(f); }
std::unordered_set< AbstractFollower * > m_followingMe
Definition Unit.hpp:665
Here is the caller graph for this function:

◆ followerRemoved()

void Unit::followerRemoved ( AbstractFollower f)
inline

Definition at line 651 of file Unit.hpp.

651{ m_followingMe.erase(f); }
Here is the caller graph for this function:

◆ getAIInterface()

AIInterface * Unit::getAIInterface ( ) const
inline

Definition at line 705 of file Unit.hpp.

705{ return m_aiInterface.get(); }

◆ getAttackPower()

uint32_t Unit::getAttackPower ( ) const

Definition at line 1590 of file Unit.cpp.

1590{ return unitData()->attack_power; }
const WoWUnit * unitData() const
Definition Unit.hpp:171
uint32_t attack_power
Definition WoWUnit.hpp:142
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAttackPowerMods()

int32_t Unit::getAttackPowerMods ( ) const

Definition at line 1624 of file Unit.cpp.

1625{
1626#if VERSION_STRING < Cata
1627 return unitData()->attack_power_mods;
1628#else
1629 return unitData()->attack_power_mod_pos - unitData()->attack_power_mod_neg;
1630#endif
1631}
int32_t attack_power_mods
Definition WoWUnit.hpp:143
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAttackPowerMultiplier()

float Unit::getAttackPowerMultiplier ( ) const

Definition at line 1654 of file Unit.cpp.

1654{ return unitData()->attack_power_multiplier; }
float attack_power_multiplier
Definition WoWUnit.hpp:144
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAttackSpeedModifier()

float Unit::getAttackSpeedModifier ( WeaponDamageType  type) const

Definition at line 6930 of file Unit.cpp.

6931{
6932 return m_attackSpeed[type];
6933}
float m_attackSpeed[TOTAL_WEAPON_DAMAGE_TYPES]
Definition Unit.hpp:1095
Here is the caller graph for this function:

◆ getAttackTimer()

uint32_t Unit::getAttackTimer ( WeaponDamageType  type) const

Definition at line 6907 of file Unit.cpp.

6908{
6909 return m_attackTimer[type];
6910}
uint32_t m_attackTimer[TOTAL_WEAPON_DAMAGE_TYPES]
Definition Unit.hpp:1093
Here is the caller graph for this function:

◆ getAuraCountForEffect()

uint32_t Unit::getAuraCountForEffect ( AuraEffect  aura_effect) const

Definition at line 5212 of file Unit.cpp.

5213{
5214 if (aura_effect >= TOTAL_SPELL_AURAS)
5215 return 0;
5216
5217 return static_cast<uint32_t>(getAuraEffectList(aura_effect).size());
5218}
@ TOTAL_SPELL_AURAS
AuraEffectList const & getAuraEffectList(AuraEffect effect) const
Definition Unit.cpp:5752
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAuraCountForId()

uint32_t Unit::getAuraCountForId ( uint32_t  auraId) const

Definition at line 5199 of file Unit.cpp.

5200{
5201 uint32_t auraCount = 0;
5202
5203 for (const auto& aur : getAuraList())
5204 {
5205 if (aur && aur->getSpellId() == auraId)
5206 ++auraCount;
5207 }
5208
5209 return auraCount;
5210}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAuraCountWithDispelType()

uint32_t Unit::getAuraCountWithDispelType ( DispelType  type,
uint64_t  casterGuid = 0 
) const

Definition at line 5220 of file Unit.cpp.

5221{
5222 uint32_t auraCount = 0;
5223
5224 for (const auto& aur : getAuraList())
5225 {
5226 if (aur == nullptr)
5227 continue;
5228
5229 if (casterGuid != 0 && aur->getCasterGuid() != casterGuid)
5230 continue;
5231
5232 if (aur->getSpellInfo()->getDispelType() == type)
5233 ++auraCount;
5234 }
5235
5236 return auraCount;
5237}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAuraEffectList()

AuraEffectList const & Unit::getAuraEffectList ( AuraEffect  effect) const

Definition at line 5752 of file Unit.cpp.

5753{
5754 return m_auraEffectList[effect];
5755}
Here is the caller graph for this function:

◆ getAuraList()

AuraArray const & Unit::getAuraList ( ) const

Definition at line 5747 of file Unit.cpp.

5748{
5749 return m_auraList;
5750}
Here is the caller graph for this function:

◆ getAuraState()

uint32_t Unit::getAuraState ( ) const

Definition at line 1228 of file Unit.cpp.

1228{ return unitData()->aura_state; }
uint32_t aura_state
Definition WoWUnit.hpp:114
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAuraUpdateMaskForRaid()

uint64_t Unit::getAuraUpdateMaskForRaid ( ) const
inline

Definition at line 1284 of file Unit.hpp.

1284{ return m_auraRaidUpdateMask; }
uint64_t m_auraRaidUpdateMask
Definition Unit.hpp:1289
Here is the caller graph for this function:

◆ getAuraWithAuraEffect()

Aura * Unit::getAuraWithAuraEffect ( AuraEffect  aura_effect) const

Definition at line 4905 of file Unit.cpp.

4906{
4907 if (aura_effect >= TOTAL_SPELL_AURAS)
4908 return nullptr;
4909
4910 if (getAuraEffectList(aura_effect).empty())
4911 return nullptr;
4912
4913 return getAuraEffectList(aura_effect).front()->getAura();
4914}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAuraWithAuraEffectForGuid()

Aura * Unit::getAuraWithAuraEffectForGuid ( AuraEffect  aura_effect,
uint64_t  guid 
) const

Definition at line 4916 of file Unit.cpp.

4917{
4918 if (aura_effect >= TOTAL_SPELL_AURAS)
4919 return nullptr;
4920
4921 if (m_auraEffectList[aura_effect].empty())
4922 return nullptr;
4923
4924 for (const auto& aurEff : m_auraEffectList[aura_effect])
4925 {
4926 if (aurEff->getAura()->getCasterGuid() == guid)
4927 return aurEff->getAura();
4928 }
4929
4930 return nullptr;
4931}

◆ getAuraWithAuraSlot()

Aura * Unit::getAuraWithAuraSlot ( uint16_t  auraSlot) const

Definition at line 4944 of file Unit.cpp.

4945{
4946 if (auraSlot >= AuraSlots::TOTAL_SLOT_END)
4947 return nullptr;
4948
4949 return m_auraList[auraSlot].get();
4950}
Here is the caller graph for this function:

◆ getAuraWithId() [1/2]

Aura * Unit::getAuraWithId ( uint32_t const auraId) const

Definition at line 4860 of file Unit.cpp.

4861{
4862 for (const auto& aur : getAuraList())
4863 {
4864 if (aur == nullptr)
4865 continue;
4866
4867 for (int i = 0; auraId[i] != 0; ++i)
4868 {
4869 if (aur->getSpellId() == auraId[i])
4870 return aur.get();
4871 }
4872 }
4873
4874 return nullptr;
4875}
Here is the call graph for this function:

◆ getAuraWithId() [2/2]

Aura * Unit::getAuraWithId ( uint32_t  spell_id) const

Definition at line 4849 of file Unit.cpp.

4850{
4851 for (const auto& aur : getAuraList())
4852 {
4853 if (aur && aur->getSpellId() == spell_id)
4854 return aur.get();
4855 }
4856
4857 return nullptr;
4858}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAuraWithIdForGuid() [1/2]

Aura * Unit::getAuraWithIdForGuid ( uint32_t const auraId,
uint64_t  guid 
) const

Definition at line 4877 of file Unit.cpp.

4878{
4879 for (const auto& aur : getAuraList())
4880 {
4881 if (aur == nullptr || aur->getCasterGuid() != guid)
4882 continue;
4883
4884 for (int i = 0; auraId[i] != 0; ++i)
4885 {
4886 if (aur->getSpellId() == auraId[i])
4887 return aur.get();
4888 }
4889 }
4890
4891 return nullptr;
4892}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAuraWithIdForGuid() [2/2]

Aura * Unit::getAuraWithIdForGuid ( uint32_t  spell_id,
uint64_t  guid 
) const

Definition at line 4894 of file Unit.cpp.

4895{
4896 for (const auto& aur : getAuraList())
4897 {
4898 if (aur && aur->getSpellId() == spell_id && aur->getCasterGuid() == target_guid)
4899 return aur.get();
4900 }
4901
4902 return nullptr;
4903}
Here is the call graph for this function:

◆ getAuraWithVisualSlot()

Aura * Unit::getAuraWithVisualSlot ( uint8_t  visualSlot) const

Definition at line 4933 of file Unit.cpp.

4934{
4935 for (const auto& aur : getAuraList())
4936 {
4937 if (aur && aur->m_visualSlot == visualSlot)
4938 return aur.get();
4939 }
4940
4941 return nullptr;
4942}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBaseAttackTime()

uint32_t Unit::getBaseAttackTime ( uint8_t  slot) const

Definition at line 1233 of file Unit.cpp.

1233{ return unitData()->base_attack_time[slot]; }
std::array< uint32_t, WOWUNIT_ATTACK_TIME_COUNT > base_attack_time
Definition WoWUnit.hpp:115
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBaseHealth()

uint32_t Unit::getBaseHealth ( ) const

Definition at line 1473 of file Unit.cpp.

1473{ return unitData()->base_health; }
uint32_t base_health
Definition WoWUnit.hpp:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBaseMana()

uint32_t Unit::getBaseMana ( ) const

Definition at line 1470 of file Unit.cpp.

1470{ return unitData()->base_mana; }
uint32_t base_mana
Definition WoWUnit.hpp:139
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBlockFromSpell()

float Unit::getBlockFromSpell ( ) const
inline

Definition at line 1518 of file Unit.hpp.

1518{ return m_blockFromSpell; }
float m_blockFromSpell
Definition Unit.hpp:1526
Here is the caller graph for this function:

◆ getBoundingRadius()

float Unit::getBoundingRadius ( ) const

Definition at line 1246 of file Unit.cpp.

1246{ return unitData()->bounding_radius; }
float bounding_radius
Definition WoWUnit.hpp:116
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBytes0()

uint32_t Unit::getBytes0 ( ) const

Definition at line 410 of file Unit.cpp.

410{ return unitData()->field_bytes_0.raw; }
field_bytes_0_union field_bytes_0
Definition WoWUnit.hpp:106
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBytes0ByOffset()

uint8_t Unit::getBytes0ByOffset ( uint32_t  offset) const

Definition at line 413 of file Unit.cpp.

414{
415 switch (offset)
416 {
417 case 0:
418 return getRace();
419 case 1:
420 return getClass();
421 case 2:
422 return getGender();
423 case 3:
424 return static_cast<uint8_t>(getPowerType());
425 default:
426 sLogger.failure("Offset {} is not a valid offset value for byte_0 data (max 3). Returning 0", offset);
427 return 0;
428 }
429}
uint8_t getGender() const
Definition Unit.cpp:459
uint8_t getRace() const
Definition Unit.cpp:453
Here is the call graph for this function:

◆ getBytes1()

uint32_t Unit::getBytes1 ( ) const

Definition at line 1294 of file Unit.cpp.

1294{ return unitData()->field_bytes_1.raw; }
field_bytes_1_union field_bytes_1
Definition WoWUnit.hpp:125
Here is the call graph for this function:

◆ getBytes1ByOffset()

uint8_t Unit::getBytes1ByOffset ( uint32_t  offset) const

Definition at line 1297 of file Unit.cpp.

1298{
1299 switch (offset)
1300 {
1301 case 0:
1302 return getStandState();
1303 case 1:
1304#if VERSION_STRING < WotLK
1305 return getPetLoyalty();
1306#elif VERSION_STRING < Mop
1307 return getPetTalentPoints();
1308#else
1309 return unitData()->field_bytes_1.s.unk1;
1310#endif
1311 case 2:
1312#if VERSION_STRING == Classic
1313 return getShapeShiftForm();
1314#else
1315 return getStandStateFlags();
1316#endif
1317 case 3:
1318#if VERSION_STRING == Classic
1319 return getStandStateFlags();
1320#else
1321 return getAnimationFlags();
1322#endif
1323 default:
1324 sLogger.failure("Offset {} is not a valid offset value for byte_1 data (max 3). Returning 0", offset);
1325 return 0;
1326 }
1327}
uint8_t getShapeShiftForm() const
Definition Unit.cpp:1386
uint8_t getStandState() const
Definition Unit.cpp:1365
struct field_bytes_1_union::parts s
Here is the call graph for this function:

◆ getBytes2()

uint32_t Unit::getBytes2 ( ) const

Definition at line 1477 of file Unit.cpp.

1477{ return unitData()->field_bytes_2.raw; }
field_bytes_2_union field_bytes_2
Definition WoWUnit.hpp:141
Here is the call graph for this function:

◆ getBytes2ByOffset()

uint8_t Unit::getBytes2ByOffset ( uint32_t  offset) const

Definition at line 1480 of file Unit.cpp.

1481{
1482 switch (offset)
1483 {
1484 case 0:
1485 return getSheathType();
1486 case 1:
1487#if VERSION_STRING == Classic
1488 return unitData()->field_bytes_2.s.unk1;
1489#elif VERSION_STRING == TBC
1490 return getPositiveAuraLimit();
1491#else
1492 return getPvpFlags();
1493#endif
1494 case 2:
1495#if VERSION_STRING == Classic
1496 return unitData()->field_bytes_2.s.unk2;
1497#else
1498 return getPetFlags();
1499#endif
1500 case 3:
1501#if VERSION_STRING == Classic
1502 return unitData()->field_bytes_2.s.unk3;
1503#else
1504 return getShapeShiftForm();
1505#endif
1506 default:
1507 sLogger.failure("Offset {} is not a valid offset value for byte_2 data (max 3). Returning 0", offset);
1508 return 0;
1509 }
1510}
uint8_t getPositiveAuraLimit() const
Definition Unit.cpp:1552
uint8_t getSheathType() const
Definition Unit.cpp:1548
struct field_bytes_2_union::parts s
Here is the call graph for this function:

◆ getCalculatedAttackPower()

int32_t Unit::getCalculatedAttackPower ( ) const

Definition at line 1813 of file Unit.cpp.

1814{
1816 float totalap = baseap * (getAttackPowerMultiplier() + 1);
1817 if (totalap >= 0)
1818 return Util::float2int32(totalap);
1819 return 0;
1820}
float getAttackPowerMultiplier() const
Definition Unit.cpp:1654
int32_t getAttackPowerMods() const
Definition Unit.cpp:1624
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCalculatedRangedAttackPower()

int32_t Unit::getCalculatedRangedAttackPower ( ) const

Definition at line 1822 of file Unit.cpp.

1823{
1825 float totalap = baseap * (getRangedAttackPowerMultiplier() + 1);
1826 if (totalap >= 0)
1827 return Util::float2int32(totalap);
1828 return 0;
1829}
int32_t getRangedAttackPower() const
Definition Unit.cpp:1593
float getRangedAttackPowerMultiplier() const
Definition Unit.cpp:1693
int32_t getRangedAttackPowerMods() const
Definition Unit.cpp:1663
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getChanceToDaze()

float Unit::getChanceToDaze ( Unit target)

Definition at line 9067 of file Unit.cpp.

9068{
9069 if (target->getLevel() < CREATURE_DAZE_MIN_LEVEL) // since 3.3.0
9070 return 0.0f;
9071
9072 float attack_skill = getLevel() * 5.0f;
9073 float defense_skill;
9074
9075 if (target->isPlayer())
9076 defense_skill = static_cast<float>(dynamic_cast<Player*>(target)->getSkillLineCurrent(SKILL_DEFENSE, false));
9077 else
9078 defense_skill = target->getLevel() * 5.0f;
9079
9080 if (!defense_skill)
9081 defense_skill = 1;
9082
9083 float chance_to_daze = attack_skill * 20 / defense_skill;//if level is equal then we get a 20% chance to daze
9084 chance_to_daze = chance_to_daze * std::min(target->getLevel() / 30.0f, 1.0f); //for targets below level 30 the chance decreases
9085 if (chance_to_daze > 40)
9086 return 40.0f;
9087
9088 return chance_to_daze;
9089}
#define CREATURE_DAZE_MIN_LEVEL
minimal level of the target player to daze, from 3.3.0
@ SKILL_DEFENSE
Definition Skill.hpp:38
Here is the call graph for this function:

◆ getChannelObjectGuid()

uint64_t Unit::getChannelObjectGuid ( ) const

Definition at line 403 of file Unit.cpp.

403{ return unitData()->channel_object_guid.guid; };
guid_union channel_object_guid
Definition WoWUnit.hpp:91
uint64_t guid
Definition GuidData.hpp:13
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getChannelSpellId()

uint32_t Unit::getChannelSpellId ( ) const

Definition at line 406 of file Unit.cpp.

406{ return unitData()->channel_spell; };
uint32_t channel_spell
Definition WoWUnit.hpp:131
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCharmedByGuid()

uint64_t Unit::getCharmedByGuid ( ) const

Definition at line 391 of file Unit.cpp.

391{ return unitData()->charmed_by_guid.guid; };
guid_union charmed_by_guid
Definition WoWUnit.hpp:86
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCharmGuid()

uint64_t Unit::getCharmGuid ( ) const

Definition at line 380 of file Unit.cpp.

380{ return unitData()->charm_guid.guid; };
guid_union charm_guid
Definition WoWUnit.hpp:84
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCharmTempVal()

uint32_t Unit::getCharmTempVal ( ) const
inline

Definition at line 1483 of file Unit.hpp.

1483{ return m_tempCharm; }
uint32_t m_tempCharm
Definition Unit.hpp:1487
Here is the caller graph for this function:

◆ getClass()

uint8_t Unit::getClass ( ) const

Definition at line 456 of file Unit.cpp.

456{ return unitData()->field_bytes_0.s.unit_class; }
struct field_bytes_0_union::parts s
Here is the call graph for this function:

◆ getClassMask()

uint32_t Unit::getClassMask ( ) const
inline

Definition at line 221 of file Unit.hpp.

221{ return 1 << (getClass() - 1); }
Here is the caller graph for this function:

◆ getCollisionHeight()

float Unit::getCollisionHeight ( ) const
overridevirtual

Reimplemented from Object.

Definition at line 8659 of file Unit.cpp.

8660{
8661 float scaleMod = getScale();
8662
8663 // Mounted
8664 if (getMountDisplayId())
8665 {
8666 if (const auto* mountDisplayInfo = sObjectMgr.getCreatureDisplayInfoData(getMountDisplayId()))
8667 {
8668 if (const auto* mountModelData = mountDisplayInfo->modelInfo)
8669 {
8670 const auto* displayInfo = sObjectMgr.getCreatureDisplayInfoData(getNativeDisplayId());
8671 if (!displayInfo)
8673
8674 const auto* modelData = displayInfo->modelInfo;
8675 if (!modelData)
8677
8678#if VERSION_STRING > Classic
8679 float const collisionHeight = scaleMod * (mountModelData->MountHeight + modelData->CollisionHeight * displayInfo->creatureModelScale * 0.5f);
8680#else
8681 // Do the Collision Calc without Mount height since there are not that many Different Mounts
8682 float const collisionHeight = scaleMod * (modelData->CollisionHeight * displayInfo->creatureModelScale * 0.5f);
8683#endif
8684 return collisionHeight == 0.0f ? DEFAULT_COLLISION_HEIGHT : collisionHeight;
8685 }
8686 }
8687 }
8688
8689 // Dismounted case
8690 const auto* displayInfo = sObjectMgr.getCreatureDisplayInfoData(getNativeDisplayId());
8691 if (!displayInfo)
8693
8694 const auto* modelData = displayInfo->modelInfo;
8695 if (!modelData)
8697
8698 float const collisionHeight = scaleMod * modelData->CollisionHeight * displayInfo->creatureModelScale;
8699 return collisionHeight == 0.0f ? DEFAULT_COLLISION_HEIGHT : collisionHeight;
8700}
#define sObjectMgr
float const DEFAULT_COLLISION_HEIGHT
Definition Object.hpp:62
float getScale() const
Definition Object.cpp:407
uint32_t getMountDisplayId() const
Definition Unit.cpp:1278
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCombatHandler() [1/2]

CombatHandler & Unit::getCombatHandler ( )

Definition at line 1803 of file Unit.cpp.

1804{
1805 return m_combatHandler;
1806}
Here is the caller graph for this function:

◆ getCombatHandler() [2/2]

CombatHandler const & Unit::getCombatHandler ( ) const

Definition at line 1808 of file Unit.cpp.

1809{
1810 return m_combatHandler;
1811}

◆ getCombatReach()

float Unit::getCombatReach ( ) const
virtual

Reimplemented from Object.

Definition at line 1249 of file Unit.cpp.

1249{ return unitData()->combat_reach; }
float combat_reach
Definition WoWUnit.hpp:117
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCreatedByGuid()

uint64_t Unit::getCreatedByGuid ( ) const

Definition at line 397 of file Unit.cpp.

397{ return unitData()->created_by_guid.guid; };
guid_union created_by_guid
Definition WoWUnit.hpp:88
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCreatedBySpellId()

uint32_t Unit::getCreatedBySpellId ( ) const

Definition at line 1430 of file Unit.cpp.

1430{ return unitData()->created_by_spell_id; }
uint32_t created_by_spell_id
Definition WoWUnit.hpp:133
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCriticalChanceForDamageSpell()

float_t Unit::getCriticalChanceForDamageSpell ( Spell spell,
Aura aura,
Unit target 
)

\ todo: this is mostly copied from legacy method, needs rewrite later

Definition at line 4045 of file Unit.cpp.

4046{
4047 if (spell == nullptr && aura == nullptr)
4048 return 0.0f;
4049
4050 SpellInfo const* spellInfo = nullptr;
4051 if (spell != nullptr)
4052 spellInfo = spell->getSpellInfo();
4053 else
4054 spellInfo = aura->getSpellInfo();
4055
4056 ///\ todo: this is mostly copied from legacy method, needs rewrite later
4057 float_t critChance = 0.0f;
4058 const auto school = spellInfo->getFirstSchoolFromSchoolMask();
4059 PlayerCombatRating resilienceType = CR_WEAPON_SKILL;
4060
4061 if (spellInfo->getDmgClass() == SPELL_DMG_TYPE_RANGED)
4062 {
4063 if (isPlayer())
4064 {
4065 critChance = dynamic_cast<Player const*>(this)->getRangedCritPercentage();
4066 if (target->isPlayer())
4067 critChance += dynamic_cast<Player*>(target)->getResistRCrit();
4068
4069 critChance += static_cast<float_t>(target->m_attackerCritChanceMod[school]);
4070 }
4071 else
4072 {
4073 // static value for mobs.. not blizzlike, but an unfinished formula is not fatal :)
4074 critChance = 5.0f;
4075 }
4076
4077 if (target->isPlayer())
4078#if VERSION_STRING >= Cata
4079 resilienceType = CR_RESILIENCE_PLAYER_DAMAGE_TAKEN;
4080#else
4081 resilienceType = CR_CRIT_TAKEN_RANGED;
4082#endif
4083 }
4084 else if (spellInfo->getDmgClass() == SPELL_DMG_TYPE_MELEE)
4085 {
4086 // Same shit with the melee spells, such as Judgment/Seal of Command
4087 if (isPlayer())
4088 critChance = dynamic_cast<Player const*>(this)->getMeleeCritPercentage();
4089
4090 if (target->isPlayer())
4091 {
4092 //this could be ability but in that case we overwrite the value
4093 critChance += dynamic_cast<Player*>(target)->getResistMCrit();
4094#if VERSION_STRING >= Cata
4095 resilienceType = CR_RESILIENCE_CRIT_TAKEN;
4096#else
4097 resilienceType = CR_CRIT_TAKEN_MELEE;
4098#endif
4099 }
4100
4101 // Victim's (!) crit chance mod for physical attacks?
4102 critChance += static_cast<float_t>(target->m_attackerCritChanceMod[0]);
4103 }
4104 else
4105 {
4106 critChance = m_spellCritPercentage + m_spellCritChanceSchool[school];
4107
4108 critChance += static_cast<float_t>(target->m_attackerCritChanceMod[school]);
4109
4110 //\todo Zyres: is tis relly the way this should work?
4111 if (isPlayer() && (target->m_rootCounter - target->m_stunned))
4112 critChance += static_cast<float_t>(dynamic_cast<Player const*>(this)->m_rootedCritChanceBonus);
4113
4114 if (target->isPlayer())
4115 resilienceType = CR_CRIT_TAKEN_SPELL;
4116 }
4117
4118 applySpellModifiers(SPELLMOD_CRITICAL, &critChance, spellInfo, spell, aura);
4119
4120 if (resilienceType != CR_WEAPON_SKILL)
4121 critChance -= dynamic_cast<Player*>(target)->calcRating(resilienceType);
4122
4123 if (critChance < 0.0f)
4124 critChance = 0.0f;
4125 if (critChance > 95.0f)
4126 critChance = 95.0f;
4127
4128 return critChance;
4129}
PlayerCombatRating
@ CR_RESILIENCE_PLAYER_DAMAGE_TAKEN
@ CR_CRIT_TAKEN_SPELL
@ CR_WEAPON_SKILL
@ CR_RESILIENCE_CRIT_TAKEN
@ SPELL_DMG_TYPE_MELEE
@ SPELL_DMG_TYPE_RANGED
@ SPELLMOD_CRITICAL
#define const
Definition zconf.h:196
float getMeleeCritPercentage() const
Definition Player.cpp:1100
float getResistRCrit()
Definition Player.hpp:888
uint8_t getFirstSchoolFromSchoolMask() const
uint32_t getDmgClass() const
SpellInfo const * getSpellInfo() const
Definition Spell.cpp:5789
int32_t m_rootCounter
Definition Unit.hpp:592
int32_t m_attackerCritChanceMod[TOTAL_SPELL_SCHOOLS]
Definition Unit.hpp:1456
int32_t m_stunned
Definition Unit.hpp:1352
float m_spellCritPercentage
Definition Unit.hpp:769
float m_spellCritChanceSchool[TOTAL_SPELL_SCHOOLS]
Definition Unit.hpp:1452
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCriticalChanceForHealSpell()

float_t Unit::getCriticalChanceForHealSpell ( Spell spell,
Aura aura,
Unit target 
)

Definition at line 4131 of file Unit.cpp.

4132{
4133 if (spell == nullptr && aura == nullptr)
4134 return 0.0f;
4135
4136 SpellInfo const* spellInfo = nullptr;
4137 if (spell != nullptr)
4138 spellInfo = spell->getSpellInfo();
4139 else
4140 spellInfo = aura->getSpellInfo();
4141
4142 const auto school = spellInfo->getFirstSchoolFromSchoolMask();
4143
4144 float_t critChance = m_spellCritPercentage + m_spellCritChanceSchool[school];
4145 applySpellModifiers(SPELLMOD_CRITICAL, &critChance, spellInfo, spell, aura);
4146
4147 if (critChance < 0.0f)
4148 critChance = 0.0f;
4149 if (critChance > 95.0f)
4150 critChance = 95.0f;
4151
4152 return critChance;
4153}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCriticalDamageBonusForSpell()

float_t Unit::getCriticalDamageBonusForSpell ( float_t  damage,
Unit target,
Spell spell,
Aura aura 
)

Definition at line 4173 of file Unit.cpp.

4174{
4175 SpellInfo const* spellInfo = nullptr;
4176 if (spell != nullptr)
4177 spellInfo = spell->getSpellInfo();
4178 else if (aura != nullptr)
4179 spellInfo = aura->getSpellInfo();
4180
4181 int32_t criticalBonus = 100;
4182 applySpellModifiers(SPELLMOD_CRITICAL_DAMAGE, &criticalBonus, spellInfo, spell, aura);
4183 if (criticalBonus > 0)
4184 {
4185 // The bonuses are halved by 50%
4186 // todo: verify
4187 if (spellInfo != nullptr && (spellInfo->getFirstSchoolFromSchoolMask() == SCHOOL_NORMAL || spellInfo->getDmgClass() == SPELL_DMG_TYPE_MELEE || spellInfo->getDmgClass() == SPELL_DMG_TYPE_RANGED))
4188 damage *= criticalBonus / 100.0f + 1.0f;
4189 else
4190 damage *= criticalBonus / 200.0f + 1.0f;
4191 }
4192
4193 // Resilience
4194 // todo: move this elsewhere and correct it to work on all versions
4195 if (target != nullptr && target->isPlayer())
4196 {
4197#if VERSION_STRING >= Cata
4198 float_t dmgReductionPct = 2.0f * dynamic_cast<Player*>(target)->calcRating(CR_RESILIENCE_CRIT_TAKEN) / 100.0f;
4199#else
4200 float_t dmgReductionPct = 2.0f * static_cast<Player*>(target)->calcRating(CR_CRIT_TAKEN_MELEE) / 100.0f;
4201#endif
4202 if (dmgReductionPct > 1.0f)
4203 dmgReductionPct = 1.0f;
4204
4205 damage -= damage * dmgReductionPct;
4206 }
4207
4208 return damage;
4209}
@ SPELLMOD_CRITICAL_DAMAGE
Here is the call graph for this function:

◆ getCriticalHealBonusForSpell()

float_t Unit::getCriticalHealBonusForSpell ( float_t  heal,
Spell spell,
Aura aura 
)

Definition at line 4211 of file Unit.cpp.

4212{
4213 SpellInfo const* spellInfo = nullptr;
4214 if (spell != nullptr)
4215 spellInfo = spell->getSpellInfo();
4216 else if (aura != nullptr)
4217 spellInfo = aura->getSpellInfo();
4218
4219 int32_t criticalBonus = 100;
4220 applySpellModifiers(SPELLMOD_CRITICAL_DAMAGE, &criticalBonus, spellInfo, spell, aura);
4221
4222 if (criticalBonus > 0)
4223 {
4224 // The bonuses are halved by 50%
4225 // todo: verify
4226 heal += heal * (criticalBonus / 200.0f);
4227 }
4228
4229 return heal;
4230}
Here is the call graph for this function:

◆ GetDamageDoneMod()

virtual int32_t Unit::GetDamageDoneMod ( uint16_t  )
inlinevirtual

Reimplemented in Creature, and Player.

Definition at line 1367 of file Unit.hpp.

1367{ return 0; }
Here is the caller graph for this function:

◆ GetDamageDonePctMod()

virtual float Unit::GetDamageDonePctMod ( uint16_t  )
inlinevirtual

Reimplemented in Creature, and Player.

Definition at line 1368 of file Unit.hpp.

1368{ return 0; }
Here is the caller graph for this function:

◆ getDeathState()

DeathState Unit::getDeathState ( ) const

Definition at line 7924 of file Unit.cpp.

7924{ return m_deathState; }
DeathState m_deathState
Definition Unit.hpp:1117
Here is the caller graph for this function:

◆ getDefaultMovementType()

MovementGeneratorType Unit::getDefaultMovementType ( ) const
virtual

Reimplemented in Creature.

Definition at line 8010 of file Unit.cpp.

8011{
8012 return IDLE_MOTION_TYPE;
8013}
@ IDLE_MOTION_TYPE
Here is the caller graph for this function:

◆ getDetectRangeMod()

int32_t Unit::getDetectRangeMod ( uint64_t  guid) const

Definition at line 7626 of file Unit.cpp.

7627{
7628 for (uint8_t i = 0; i < 5; i++)
7629 {
7630 if (m_detectRangeGuids[i] == guid)
7631 return m_detectRangeMods[i];
7632 }
7633 return 0;
7634}
uint64_t m_detectRangeGuids[5]
Definition Unit.hpp:1480
int32_t m_detectRangeMods[5]
Definition Unit.hpp:1481
Here is the caller graph for this function:

◆ getDisplayId()

uint32_t Unit::getDisplayId ( ) const

Definition at line 1252 of file Unit.cpp.

1252{ return unitData()->display_id; }
uint32_t display_id
Definition WoWUnit.hpp:118
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDodgeFromSpell()

float Unit::getDodgeFromSpell ( ) const
inline

Definition at line 1520 of file Unit.hpp.

1520{ return m_dodgeFromSpell; }
float m_dodgeFromSpell
Definition Unit.hpp:1527
Here is the caller graph for this function:

◆ getEmoteState()

uint32_t Unit::getEmoteState ( ) const

Definition at line 1445 of file Unit.cpp.

1445{ return unitData()->npc_emote_state; }
uint32_t npc_emote_state
Definition WoWUnit.hpp:135
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getExtraUnitMovementFlags()

uint16_t Unit::getExtraUnitMovementFlags ( ) const

Definition at line 1940 of file Unit.cpp.

1940{ return obj_movement_info.flags2; }
Here is the caller graph for this function:

◆ getFactionTemplate()

uint32_t Unit::getFactionTemplate ( ) const

Definition at line 957 of file Unit.cpp.

957{ return unitData()->faction_template; }
uint32_t faction_template
Definition WoWUnit.hpp:105
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFastestSpeedType()

UnitSpeedType Unit::getFastestSpeedType ( ) const

Definition at line 2908 of file Unit.cpp.

2909{
2910 float fastest_speed = 0.f;
2911 UnitSpeedType fastest_speed_type = TYPE_WALK;
2912 for (uint8_t i = TYPE_WALK; i < MAX_SPEED_TYPE; ++i)
2913 {
2914 UnitSpeedType const speedType = static_cast<UnitSpeedType>(i + 1);
2915
2916 switch (speedType)
2917 {
2918 case TYPE_TURN_RATE:
2919 case TYPE_PITCH_RATE:
2920 continue;
2921 default:
2922 break;
2923 }
2924
2925 float const speed = getSpeedRate(speedType, true);
2926
2927 fastest_speed = speed > fastest_speed ? speed : fastest_speed;
2928 fastest_speed_type = speed == fastest_speed ? speedType : fastest_speed_type;
2929 }
2930
2931 return fastest_speed_type;
2932}
UnitSpeedType
@ MAX_SPEED_TYPE
@ TYPE_WALK
@ TYPE_TURN_RATE
@ TYPE_PITCH_RATE
Here is the call graph for this function:

◆ getFollowAngle()

virtual float Unit::getFollowAngle ( ) const
inlinevirtual

Definition at line 653 of file Unit.hpp.

653{ return static_cast<float>(M_PI / 2); }
#define M_PI
Here is the caller graph for this function:

◆ getGameObject()

GameObject * Unit::getGameObject ( uint32_t  spellId) const

Definition at line 8702 of file Unit.cpp.

8703{
8704 for (GameObjectList::const_iterator i = m_gameObj.begin(); i != m_gameObj.end(); ++i)
8705 if ((*i)->getSpellId() == spellId)
8706 return *i;
8707
8708 return nullptr;
8709}
Here is the caller graph for this function:

◆ getGender()

uint8_t Unit::getGender ( ) const

Definition at line 459 of file Unit.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getGeneratedThreatModifyer()

int32_t Unit::getGeneratedThreatModifyer ( uint32_t  school)
inline

Definition at line 1200 of file Unit.hpp.

1200{ return m_generatedThreatModifyer[school]; }
int32_t m_generatedThreatModifyer[TOTAL_SPELL_SCHOOLS]
Definition Unit.hpp:1187
Here is the caller graph for this function:

◆ getHealth()

uint32_t Unit::getHealth ( ) const

Definition at line 481 of file Unit.cpp.

481{ return unitData()->health; }
uint32_t health
Definition WoWUnit.hpp:92
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHealthPct()

uint8_t Unit::getHealthPct ( ) const

Definition at line 6704 of file Unit.cpp.

6705{
6706 if (getHealth() <= 0 || getMaxHealth() <= 0)
6707 return 0;
6708
6709 if (getHealth() >= getMaxHealth())
6710 return 100;
6711
6712 return static_cast<uint8_t>(getHealth() * 100 / getMaxHealth());
6713}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHitFromMeleeSpell()

float Unit::getHitFromMeleeSpell ( )
inline

Definition at line 1343 of file Unit.hpp.

1343{ return m_hitFromMeleeSpell; }
float m_hitFromMeleeSpell
Definition Unit.hpp:1344
Here is the caller graph for this function:

◆ getHoverHeight()

float Unit::getHoverHeight ( ) const

Definition at line 1703 of file Unit.cpp.

1703{ return unitData()->hover_height; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getInvisibilityDetection()

int32_t Unit::getInvisibilityDetection ( InvisibilityFlag  flag) const

Definition at line 6215 of file Unit.cpp.

6216{
6217 return m_invisibilityDetection[flag];
6218}
int32_t m_invisibilityDetection[INVIS_FLAG_TOTAL]
Definition Unit.hpp:936
Here is the caller graph for this function:

◆ getInvisibilityLevel()

int32_t Unit::getInvisibilityLevel ( InvisibilityFlag  flag) const

Definition at line 6210 of file Unit.cpp.

6211{
6212 return m_invisibilityLevel[flag];
6213}
int32_t m_invisibilityLevel[INVIS_FLAG_TOTAL]
Definition Unit.hpp:935
Here is the caller graph for this function:

◆ getLevel()

uint32_t Unit::getLevel ( ) const

Definition at line 936 of file Unit.cpp.

936{ return unitData()->level; }
uint32_t level
Definition WoWUnit.hpp:104
Here is the call graph for this function:

◆ getManaShieldAbsorbedDamage()

uint32_t Unit::getManaShieldAbsorbedDamage ( uint32_t  damage)

Definition at line 9647 of file Unit.cpp.

9648{
9649 if (!m_manashieldAmount)
9650 return 0;
9651
9653
9654 int32_t potential = (mana * 50) / 100;
9655 if (potential > m_manashieldAmount)
9656 potential = m_manashieldAmount;
9657
9658 if (static_cast<int32_t>(damage) < potential)
9659 potential = damage;
9660
9661 uint32_t cost = (potential * 100) / 50;
9662
9663 setPower(POWER_TYPE_MANA, mana - cost);
9664
9665 m_manashieldAmount -= potential;
9666 if (!m_manashieldAmount)
9668
9669 return potential;
9670}
uint32_t m_manaShieldId
Definition Unit.hpp:1532
int32_t m_manashieldAmount
Definition Unit.hpp:1531
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMaxDamage()

float Unit::getMaxDamage ( ) const

Definition at line 1284 of file Unit.cpp.

1284{ return unitData()->maximum_damage; }
float maximum_damage
Definition WoWUnit.hpp:122
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMaxHealth()

uint32_t Unit::getMaxHealth ( ) const

Definition at line 625 of file Unit.cpp.

625{ return unitData()->max_health; }
uint32_t max_health
Definition WoWUnit.hpp:98
Here is the call graph for this function:

◆ getMaxOffhandDamage()

float Unit::getMaxOffhandDamage ( ) const

Definition at line 1290 of file Unit.cpp.

1290{ return unitData()->maximum_offhand_damage; }
float maximum_offhand_damage
Definition WoWUnit.hpp:124
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMaxPower()

uint32_t Unit::getMaxPower ( PowerType  type) const

Definition at line 654 of file Unit.cpp.

655{
656 if (type == POWER_TYPE_HEALTH)
657 return getMaxHealth();
658
659 // Since cata power fields work differently
660 // Get matching power index by power type
661 const auto powerIndex = getPowerIndexFromDBC(type);
662 switch (powerIndex)
663 {
665 return unitData()->max_power_1;
667 return unitData()->max_power_2;
669 return unitData()->max_power_3;
671 return unitData()->max_power_4;
673 return unitData()->max_power_5;
674#if VERSION_STRING == WotLK
676 return unitData()->max_power_6;
678 return unitData()->max_power_7;
679#endif
680 default:
681 return 0;
682 }
683}
@ POWER_TYPE_HEALTH
Definition PowerType.hpp:12
@ POWER_FIELD_INDEX_2
@ POWER_FIELD_INDEX_3
@ POWER_FIELD_INDEX_1
@ POWER_FIELD_INDEX_4
@ POWER_FIELD_INDEX_7
@ POWER_FIELD_INDEX_6
@ POWER_FIELD_INDEX_5
uint8_t getPowerIndexFromDBC(PowerType type) const
Definition Unit.cpp:6744
uint32_t max_power_1
Definition WoWUnit.hpp:99
uint32_t max_power_3
Definition WoWUnit.hpp:101
uint32_t max_power_2
Definition WoWUnit.hpp:100
uint32_t max_power_4
Definition WoWUnit.hpp:102
uint32_t max_power_5
Definition WoWUnit.hpp:103
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMaxRangedDamage()

float Unit::getMaxRangedDamage ( ) const

Definition at line 1599 of file Unit.cpp.

1599{ return unitData()->maximum_ranged_ddamage; }
float maximum_ranged_ddamage
Definition WoWUnit.hpp:149
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMeleeRange()

float Unit::getMeleeRange ( Unit target)

Definition at line 1759 of file Unit.cpp.

1760{
1761 float range = getCombatReach() + target->getCombatReach() + 4.0f / 3.0f;
1762 return std::max(range, NOMINAL_MELEE_RANGE);
1763}
#define NOMINAL_MELEE_RANGE
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMinDamage()

float Unit::getMinDamage ( ) const

Definition at line 1281 of file Unit.cpp.

1281{ return unitData()->minimum_damage; }
float minimum_damage
Definition WoWUnit.hpp:121
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMinOffhandDamage()

float Unit::getMinOffhandDamage ( ) const

Definition at line 1287 of file Unit.cpp.

1287{ return unitData()->minimum_offhand_damage; }
float minimum_offhand_damage
Definition WoWUnit.hpp:123
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMinRangedDamage()

float Unit::getMinRangedDamage ( ) const

Definition at line 1596 of file Unit.cpp.

1596{ return unitData()->minimum_ranged_damage; }
float minimum_ranged_damage
Definition WoWUnit.hpp:148
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getModCastSpeed()

float Unit::getModCastSpeed ( ) const

Definition at line 1421 of file Unit.cpp.

1421{ return unitData()->mod_cast_speed; }
float mod_cast_speed
Definition WoWUnit.hpp:132
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getModelHalfSize()

float Unit::getModelHalfSize ( ) const
inline

Definition at line 1510 of file Unit.hpp.

1510{ return m_modelHalfSize * getScale(); }
Here is the caller graph for this function:

◆ getMountCapability()

WDB::Structures::MountCapabilityEntry const * Unit::getMountCapability ( uint32_t  mountType)

Definition at line 8016 of file Unit.cpp.

8017{
8018 if (!mountType)
8019 return nullptr;
8020
8021 auto const* mountTypeEntry = sMountTypeStore.lookupEntry(mountType);
8022 if (!mountTypeEntry)
8023 return nullptr;
8024
8025 uint32_t zoneId = 0;
8026 uint32_t areaId = 0;
8027
8028 if (getZoneId())
8029 zoneId = getZoneId();
8030
8031 if (GetArea())
8032 areaId = GetArea()->id;
8033
8034 uint32_t ridingSkill = 5000;
8036 ridingSkill = ToPlayer()->getSkillLineCurrent(SKILL_RIDING);
8037
8038 for (uint32_t i = MAX_MOUNT_CAPABILITIES; i > 0; --i)
8039 {
8040 auto const* mountCapability = sMountCapabilityStore.lookupEntry(mountTypeEntry->capabilities[i - 1]);
8041 if (!mountCapability)
8042 continue;
8043
8044 if (ridingSkill < mountCapability->reqRidingSkill)
8045 continue;
8046
8048 {
8049 if (!(mountCapability->flag & MOUNT_FLAG_CAN_PITCH))
8050 continue;
8051 }
8053 {
8054 if (!(mountCapability->flag & MOUNT_FLAG_CAN_SWIM))
8055 continue;
8056 }
8057 else if (!(mountCapability->flag & 0x1)) // unknown flags, checked in 4.2.2 14545 client
8058 {
8059 if (!(mountCapability->flag & 0x2))
8060 continue;
8061 }
8062
8063 if (mountCapability->reqMap != -1 && int32_t(GetMapId()) != mountCapability->reqMap)
8064 continue;
8065
8066 if (mountCapability->reqArea && (mountCapability->reqArea != zoneId && mountCapability->reqArea != areaId))
8067 continue;
8068
8069 if (mountCapability->reqAura && !hasAurasWithId(mountCapability->reqAura))
8070 continue;
8071
8072 if (mountCapability->reqSpell && (GetTypeFromGUID() != TYPEID_PLAYER || !ToPlayer()->hasSpell(mountCapability->reqSpell)))
8073 continue;
8074
8075 return mountCapability;
8076 }
8077
8078 return nullptr;
8079}
@ MOVEFLAG2_FULLSPEED_PITCHING
@ SKILL_RIDING
Definition Skill.hpp:163
SERVER_DECL WDB::WDBContainer< WDB::Structures::MountCapabilityEntry > sMountCapabilityStore
SERVER_DECL WDB::WDBContainer< WDB::Structures::MountTypeEntry > sMountTypeStore
#define MAX_MOUNT_CAPABILITIES
@ MOUNT_FLAG_CAN_PITCH
@ MOUNT_FLAG_CAN_SWIM
uint32_t GetTypeFromGUID() const
Definition Object.hpp:337
::WDB::Structures::AreaTableEntry const * GetArea() const
Definition Object.cpp:1766
const uint32_t & getZoneId() const
Definition Object.hpp:469
uint16_t getSkillLineCurrent(uint16_t skillLine, bool includeBonus=true) const
Definition Player.cpp:4928
bool hasAurasWithId(uint32_t auraId) const
Definition Unit.cpp:5004
bool hasExtraUnitMovementFlag(uint16_t f2) const
Definition Unit.cpp:1942
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMountDisplayId()

uint32_t Unit::getMountDisplayId ( ) const

Definition at line 1278 of file Unit.cpp.

1278{ return unitData()->mount_display_id; }
uint32_t mount_display_id
Definition WoWUnit.hpp:120
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMovementInfo()

MovementInfo * Unit::getMovementInfo ( )

Definition at line 1931 of file Unit.cpp.

1931{ return &obj_movement_info; }
Here is the caller graph for this function:

◆ getMovementManager() [1/2]

MovementManager * Unit::getMovementManager ( )
inline

Definition at line 655 of file Unit.hpp.

655{ return i_movementManager.get(); }

◆ getMovementManager() [2/2]

MovementManager const * Unit::getMovementManager ( ) const
inline

Definition at line 656 of file Unit.hpp.

656{ return i_movementManager.get(); }

◆ getNativeDisplayId()

uint32_t Unit::getNativeDisplayId ( ) const

Definition at line 1275 of file Unit.cpp.

1275{ return unitData()->native_display_id; }
uint32_t native_display_id
Definition WoWUnit.hpp:119
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNpcFlags()

uint64_t Unit::getNpcFlags ( ) const

Definition at line 1439 of file Unit.cpp.

1439{ return unitData()->npc_flags; }
uint32_t npc_flags
Definition WoWUnit.hpp:134
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOldEmote()

uint32_t Unit::getOldEmote ( ) const

Definition at line 7087 of file Unit.cpp.

7087{ return m_oldEmote; }

◆ getOnMeleeSpell()

uint32_t Unit::getOnMeleeSpell ( ) const
inline

Definition at line 1334 of file Unit.hpp.

1334{ return m_meleeSpell; }
uint32_t m_meleeSpell
Definition Unit.hpp:1338
Here is the caller graph for this function:

◆ getOnMeleeSpellEcn()

uint8_t Unit::getOnMeleeSpellEcn ( ) const
inline

Definition at line 1335 of file Unit.hpp.

1335{ return m_meleeSpell_ecn; }
uint8_t m_meleeSpell_ecn
Definition Unit.hpp:1339
Here is the caller graph for this function:

◆ getParryFromSpell()

float Unit::getParryFromSpell ( ) const
inline

Definition at line 1519 of file Unit.hpp.

1519{ return m_parryFromSpell; }
float m_parryFromSpell
Definition Unit.hpp:1528
Here is the caller graph for this function:

◆ getPctFromMaxHealth()

uint8_t Unit::getPctFromMaxHealth ( uint8_t  pct) const

Definition at line 6715 of file Unit.cpp.

6716{
6717 return static_cast<uint8_t>(getMaxHealth() * static_cast<float>(pct) / 100.0f);
6718}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPet()

Pet * Unit::getPet ( ) const

Definition at line 7929 of file Unit.cpp.

7930{
7931 return m_summonInterface->getPet();
7932}
Here is the call graph for this function:

◆ getPetExperience()

uint32_t Unit::getPetExperience ( ) const

Definition at line 1407 of file Unit.cpp.

1407{ return unitData()->pet_experience; }
uint32_t pet_experience
Definition WoWUnit.hpp:128
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPetFlags()

uint8_t Unit::getPetFlags ( ) const

Definition at line 1580 of file Unit.cpp.

1580{ return unitData()->field_bytes_2.s.pet_flag; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPetNameTimestamp()

uint32_t Unit::getPetNameTimestamp ( ) const

Definition at line 1404 of file Unit.cpp.

1404{ return unitData()->pet_name_timestamp; }
uint32_t pet_name_timestamp
Definition WoWUnit.hpp:127
Here is the call graph for this function:

◆ getPetNextLevelExperience()

uint32_t Unit::getPetNextLevelExperience ( ) const

Definition at line 1410 of file Unit.cpp.

uint32_t pet_next_level_experience
Definition WoWUnit.hpp:129
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPetNumber()

uint32_t Unit::getPetNumber ( ) const

Definition at line 1401 of file Unit.cpp.

1401{ return unitData()->pet_number; }
uint32_t pet_number
Definition WoWUnit.hpp:126
Here is the call graph for this function:

◆ getPositiveAuraLimit()

uint8_t Unit::getPositiveAuraLimit ( ) const

Definition at line 1552 of file Unit.cpp.

1552{ return unitData()->field_bytes_2.s.positive_aura_limit; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPower()

uint32_t Unit::getPower ( PowerType  type) const

Definition at line 516 of file Unit.cpp.

517{
518 if (type == POWER_TYPE_HEALTH)
519 return getHealth();
520
521 // Since cata power fields work differently
522 // Get matching power index by power type
523 const auto powerIndex = getPowerIndexFromDBC(type);
524 switch (powerIndex)
525 {
527 return unitData()->power_1;
529 return unitData()->power_2;
531 return unitData()->power_3;
533 return unitData()->power_4;
535 return unitData()->power_5;
536#if VERSION_STRING == WotLK
538 return unitData()->power_6;
540 return unitData()->power_7;
541#endif
542 default:
543 return 0;
544 }
545}
uint32_t power_4
Definition WoWUnit.hpp:96
uint32_t power_3
Definition WoWUnit.hpp:95
uint32_t power_2
Definition WoWUnit.hpp:94
uint32_t power_1
Definition WoWUnit.hpp:93
uint32_t power_5
Definition WoWUnit.hpp:97
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPowerCostModifier()

uint32_t Unit::getPowerCostModifier ( uint16_t  school) const

Definition at line 1602 of file Unit.cpp.

1602{ return unitData()->power_cost_modifier[school]; }
std::array< uint32_t, WOWUNIT_SPELL_SCHOOL_COUNT > power_cost_modifier
Definition WoWUnit.hpp:150
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPowerCostMultiplier()

float Unit::getPowerCostMultiplier ( uint16_t  school) const

Definition at line 1615 of file Unit.cpp.

1615{ return unitData()->power_cost_multiplier[school]; }
std::array< float, WOWUNIT_SPELL_SCHOOL_COUNT > power_cost_multiplier
Definition WoWUnit.hpp:151
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPowerIndexFromDBC()

uint8_t Unit::getPowerIndexFromDBC ( PowerType  type) const
private

Definition at line 6744 of file Unit.cpp.

6745{
6746#if VERSION_STRING <= WotLK
6747 // Prior to Cataclysm power type equals index
6748 return static_cast<uint8_t>(type + 1);
6749#else
6750 if (!isPlayer())
6751 {
6752 // For creatures return first index
6753 //\ todo: can creatures use multiple power types?
6754 return POWER_FIELD_INDEX_1;
6755 }
6756
6757 return getPowerIndexByClass(getClass(), static_cast<uint8_t>(type));
6758#endif
6759}
uint8_t getPowerIndexByClass(uint8_t playerClass, uint8_t powerType)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPowerPct()

uint8_t Unit::getPowerPct ( PowerType  powerType) const

Definition at line 6720 of file Unit.cpp.

6721{
6722 if (powerType == POWER_TYPE_HEALTH)
6723 return getHealthPct();
6724
6725 if (getPower(powerType) <= 0 || getMaxPower(powerType) <= 0)
6726 return 0;
6727
6728 if (getPower(powerType) >= getMaxPower(powerType))
6729 return 100;
6730
6731 return static_cast<uint8_t>(getPower(powerType) * 100 / getMaxPower(powerType));
6732}
uint32_t getMaxPower(PowerType type) const
Definition Unit.cpp:654
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPowerRegeneration()

float Unit::getPowerRegeneration ( PowerType  type) const

Definition at line 750 of file Unit.cpp.

751{
752#if VERSION_STRING < WotLK
753 switch (type)
754 {
755 case POWER_TYPE_MANA:
756#if VERSION_STRING == TBC
757 if (isPlayer())
758 return dynamic_cast<Player const*>(this)->getManaRegeneration();
759 else
760#endif
761 return m_manaRegeneration;
762 case POWER_TYPE_RAGE:
763 return m_rageRegeneration;
764 case POWER_TYPE_FOCUS:
765 return m_focusRegeneration;
767 return m_energyRegeneration;
768 default:
769 return 0.0f;
770 }
771#else
772 if (type == POWER_TYPE_HEALTH)
773 return 0.0f;
774
775 const auto powerIndex = getPowerIndexFromDBC(type);
776 switch (powerIndex)
777 {
783#if VERSION_STRING == WotLK
786#endif
787 return unitData()->power_regen_flat_modifier[powerIndex - 1];
788 default:
789 return 0.0f;
790 }
791#endif
792}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPowerRegenerationWhileInterrupted()

float Unit::getPowerRegenerationWhileInterrupted ( PowerType  type) const

Definition at line 843 of file Unit.cpp.

844{
845#if VERSION_STRING < WotLK
846 switch (type)
847 {
848 case POWER_TYPE_MANA:
849#if VERSION_STRING == TBC
850 if (isPlayer())
851 return dynamic_cast<Player const*>(this)->getManaRegenerationWhileCasting();
852 else
853#endif
854 return m_manaRegenerationWhileCasting;
855 case POWER_TYPE_RAGE:
856 return m_rageRegenerationWhileCombat;
857 case POWER_TYPE_FOCUS:
858 return m_focusRegeneration;
860 return m_energyRegeneration;
861 default:
862 return 0.0f;
863 }
864#else
865 if (type == POWER_TYPE_HEALTH)
866 return 0.0f;
867
868 const auto powerIndex = getPowerIndexFromDBC(type);
869 switch (powerIndex)
870 {
876#if VERSION_STRING == WotLK
879#endif
880 return unitData()->power_regen_interrupted_flat_modifier[powerIndex - 1];
881 default:
882 return 0.0f;
883 }
884#endif
885}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPowerType()

PowerType Unit::getPowerType ( ) const

Definition at line 462 of file Unit.cpp.

462{ return static_cast<PowerType>(unitData()->field_bytes_0.s.power_type); }
PowerType
Definition PowerType.hpp:11
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getProcTriggerSpell()

SpellProc * Unit::getProcTriggerSpell ( uint32_t  spellId,
uint64_t  casterGuid 
) const

Definition at line 3762 of file Unit.cpp.

3763{
3764 for (const auto& spellProc : m_procSpells)
3765 {
3766 if (spellProc->getSpell()->getId() == spellId && (casterGuid == 0 || spellProc->getCasterGuid() == casterGuid))
3767 return spellProc.get();
3768 }
3769
3770 return nullptr;
3771}
Here is the caller graph for this function:

◆ getRace()

uint8_t Unit::getRace ( ) const

Definition at line 453 of file Unit.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRaceMask()

uint32_t Unit::getRaceMask ( ) const
inline

Definition at line 217 of file Unit.hpp.

217{ return 1 << (getRace() - 1); }
Here is the caller graph for this function:

◆ getRangedAttackPower()

int32_t Unit::getRangedAttackPower ( ) const

Definition at line 1593 of file Unit.cpp.

1593{ return unitData()->ranged_attack_power; }
int32_t ranged_attack_power
Definition WoWUnit.hpp:145
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRangedAttackPowerMods()

int32_t Unit::getRangedAttackPowerMods ( ) const

Definition at line 1663 of file Unit.cpp.

1664{
1665#if VERSION_STRING < Cata
1667#else
1668 return unitData()->ranged_attack_power_mods_pos - unitData()->ranged_attack_power_mods_neg;
1669#endif
1670}
int32_t ranged_attack_power_mods
Definition WoWUnit.hpp:146
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRangedAttackPowerMultiplier()

float Unit::getRangedAttackPowerMultiplier ( ) const

Definition at line 1693 of file Unit.cpp.

float ranged_attack_power_multiplier
Definition WoWUnit.hpp:147
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getResistance()

uint32_t Unit::getResistance ( uint8_t  type) const

Definition at line 1459 of file Unit.cpp.

1459{ return unitData()->resistance[type]; }
std::array< uint32_t, WOWUNIT_SPELL_SCHOOL_COUNT > resistance
Definition WoWUnit.hpp:138
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getResistChanceMod()

uint32_t Unit::getResistChanceMod ( ) const
inline

Definition at line 1357 of file Unit.hpp.

1357{ return m_resistChance; }
int32_t m_resistChance
Definition Unit.hpp:1359

◆ getShapeShiftForm()

uint8_t Unit::getShapeShiftForm ( ) const

Definition at line 1386 of file Unit.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getShapeShiftMask()

uint32_t Unit::getShapeShiftMask ( ) const
inline

Definition at line 483 of file Unit.hpp.

483{ return 1 << (getShapeShiftForm() - 1); }
Here is the caller graph for this function:

◆ getSheathType()

uint8_t Unit::getSheathType ( ) const

Definition at line 1548 of file Unit.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSingleTargetGuidForAura() [1/2]

uint64_t Unit::getSingleTargetGuidForAura ( uint32_t const spellIds,
uint32_t index 
)

Definition at line 5497 of file Unit.cpp.

5498{
5499 for (uint8_t i = 0; ; i++)
5500 {
5501 if (!spellIds[i])
5502 return 0;
5503
5504 auto itr = m_singleTargetAura.find(spellIds[i]);
5505
5506 if (itr != m_singleTargetAura.end())
5507 {
5508 *index = i;
5509 return itr->second;
5510 }
5511 }
5512}

◆ getSingleTargetGuidForAura() [2/2]

uint64_t Unit::getSingleTargetGuidForAura ( uint32_t  spellId)

Definition at line 5487 of file Unit.cpp.

5488{
5489 auto itr = m_singleTargetAura.find(spell);
5490
5491 if (itr != m_singleTargetAura.end())
5492 return itr->second;
5493 else
5494 return 0;
5495}
Here is the caller graph for this function:

◆ getSpeedDecrease()

bool Unit::getSpeedDecrease ( )

Definition at line 2934 of file Unit.cpp.

2935{
2936 int32_t before = m_speedModifier;
2938 m_slowdown = 0;
2939
2940 for (auto& itr : speedReductionMap)
2941 m_slowdown = static_cast<int32_t>(std::min(m_slowdown, itr.second));
2942
2943 if (m_slowdown < -100)
2944 m_slowdown = 100;
2945
2947
2948 if (m_speedModifier != before)
2949 return true;
2950
2951 return false;
2952}
int32_t m_speedModifier
Definition Unit.hpp:624
int32_t m_slowdown
Definition Unit.hpp:627
std::map< uint32_t, int32_t > speedReductionMap
Definition Unit.hpp:630
T min(const T &x, const T &y)
Definition g3dmath.h:305
Here is the caller graph for this function:

◆ getSpeedInfo()

UnitSpeedInfo const * Unit::getSpeedInfo ( ) const
inline

Definition at line 635 of file Unit.hpp.

635{ return &m_UnitSpeedInfo; }
UnitSpeedInfo m_UnitSpeedInfo
Definition Unit.hpp:621

◆ getSpeedRate()

float Unit::getSpeedRate ( UnitSpeedType  type,
bool  current 
) const

Definition at line 2549 of file Unit.cpp.

2550{
2551 if (current)
2553 else
2555}
float m_basicSpeedRate[MAX_SPEED_TYPE]
float m_currentSpeedRate[MAX_SPEED_TYPE]
Here is the caller graph for this function:

◆ getSpellDidHitResult()

uint32_t Unit::getSpellDidHitResult ( Unit pVictim,
uint32_t  weapon_damage_type,
Spell castingSpell 
)

Combat.

Definition at line 10178 of file Unit.cpp.

10179{
10180 Item* it = NULL;
10181 float hitchance = 0.0f;
10182 float dodge = 0.0f;
10183 float parry = 0.0f;
10184 float block = 0.0f;
10185
10186 float hitmodifier = 0;
10187 int32_t self_skill;
10188 int32_t victim_skill;
10189 uint16_t SubClassSkill = SKILL_UNARMED;
10190 const auto ability = castingSpell->getSpellInfo();
10191
10192 bool backAttack = !pVictim->isInFront(this); // isInBack is bugged!
10193 uint32_t vskill = 0;
10194
10195 //////////////////////////////////////////////////////////////////////////////////////////
10196 //Victim Skill Base Calculation
10197 if (pVictim->isPlayer())
10198 {
10199 vskill = static_cast<Player*>(pVictim)->getSkillLineCurrent(SKILL_DEFENSE);
10200 if (weapon_damage_type != RANGED && !backAttack) // block chance
10201 {
10202 block = static_cast<Player*>(pVictim)->getBlockPercentage(); //shield check already done in Update chances
10203
10204 if (pVictim->m_stunned <= 0) // dodge chance
10205 {
10206 dodge = static_cast<Player*>(pVictim)->getDodgePercentage();
10207 }
10208
10209 if (pVictim->m_canParry && !pVictim->m_isDisarmed) // parry chance
10210 {
10211 if (static_cast<Player*>(pVictim)->hasSpell(3127) || static_cast<Player*>(pVictim)->hasSpell(18848))
10212 {
10213 parry = static_cast<Player*>(pVictim)->getParryPercentage();
10214 }
10215 }
10216 }
10217 victim_skill = Util::float2int32(vskill + static_cast<Player*>(pVictim)->calcRating(CR_DEFENSE_SKILL));
10218 }
10219 else // mob defensive chances
10220 {
10221 if (weapon_damage_type != RANGED && !backAttack)
10222 dodge = pVictim->getStat(STAT_AGILITY) / 14.5f; // what is this value?
10223 victim_skill = pVictim->getLevel() * 5;
10224
10225 if (pVictim->isCreature())
10226 {
10227 Creature* c = static_cast<Creature*>(pVictim);
10229 {
10230 victim_skill = std::max(victim_skill, (static_cast<int32_t>(this->getLevel()) + 3) * 5); //used max to avoid situation when lowlvl hits boss.
10231 }
10232 }
10233 }
10234 //////////////////////////////////////////////////////////////////////////////////////////
10235 //Attacker Skill Base Calculation
10236 if (this->isPlayer())
10237 {
10238 self_skill = 0;
10239 Player* pr = static_cast<Player*>(this);
10240 hitmodifier = pr->getHitFromMeleeSpell();
10241
10242 switch (weapon_damage_type)
10243 {
10244 case MELEE: // melee main hand weapon
10246 hitmodifier += pr->calcRating(CR_HIT_MELEE);
10248 break;
10249 case OFFHAND: // melee offhand weapon (dualwield)
10251 hitmodifier += pr->calcRating(CR_HIT_MELEE);
10253 break;
10254 case RANGED: // ranged weapon
10256 hitmodifier += pr->calcRating(CR_HIT_RANGED);
10258 break;
10259 }
10260
10261 // erm. some spells don't use ranged weapon skill but are still a ranged spell and use melee stats instead
10262 // i.e. hammer of wrath
10263 if (ability)
10264 {
10265 switch (ability->getId())
10266 {
10267 //SPELL_HASH_HAMMER_OF_WRATH
10268 case 24239:
10269 case 24274:
10270 case 24275:
10271 case 27180:
10272 case 32772:
10273 case 37251:
10274 case 37255:
10275 case 37259:
10276 case 48805:
10277 case 48806:
10278 case 51384:
10279 {
10281 hitmodifier += pr->calcRating(CR_HIT_MELEE);
10283 } break;
10284 default:
10285 break;
10286 }
10287 }
10288
10289 if (it)
10290 SubClassSkill = it->getRequiredSkill();
10291 else
10292 SubClassSkill = SKILL_UNARMED;
10293
10294 if (SubClassSkill == SKILL_FIST_WEAPONS)
10295 SubClassSkill = SKILL_UNARMED;
10296
10297 //chances in feral form don't depend on weapon skill
10298 if (static_cast<Player*>(this)->isInFeralForm())
10299 {
10300 uint8_t form = this->getShapeShiftForm();
10301 if (form == FORM_CAT || form == FORM_BEAR || form == FORM_DIREBEAR)
10302 {
10303#if VERSION_STRING <= Cata
10304 SubClassSkill = SKILL_FERAL_COMBAT;
10305#endif
10306 self_skill += pr->getLevel() * 5; // Adjust skill for Level * 5 for Feral Combat
10307 }
10308 }
10309
10310
10311 self_skill += pr->getSkillLineCurrent(SubClassSkill);
10312 }
10313 else
10314 {
10315 self_skill = this->getLevel() * 5;
10316 if (isCreature())
10317 {
10318 Creature* c = static_cast<Creature*>(this);
10320 self_skill = std::max(self_skill, (static_cast<int32_t>(pVictim->getLevel()) + 3) * 5); //used max to avoid situation when lowlvl hits boss.
10321 }
10322 }
10323 //////////////////////////////////////////////////////////////////////////////////////////
10324 //Special Chances Base Calculation
10325 //<THE SHIT> to avoid Linux bug.
10326 float diffVcapped = static_cast<float>(self_skill);
10327 if (static_cast<int32_t>(pVictim->getLevel() * 5) > victim_skill)
10328 diffVcapped -= static_cast<float>(victim_skill);
10329 else
10330 diffVcapped -= static_cast<float>(pVictim->getLevel() * 5);
10331
10332 float diffAcapped = static_cast<float>(victim_skill);
10333 if (static_cast<int32_t>(this->getLevel() * 5) > self_skill)
10334 diffAcapped -= static_cast<float>(self_skill);
10335 else
10336 diffAcapped -= static_cast<float>(getLevel() * 5);
10337 //<SHIT END>
10338
10339 // by victim state
10340 if (pVictim->isPlayer() && pVictim->getStandState()) //every not standing state is>0
10341 {
10342 hitchance = 100.0f;
10343 }
10344
10345 // by damage type and by weapon type
10346 if (weapon_damage_type == RANGED)
10347 {
10348 dodge = 0.0f;
10349 parry = 0.0f;
10350 }
10351
10352 // by skill difference
10353 float vsk = static_cast<float>(self_skill) - static_cast<float>(victim_skill);
10354 dodge = std::max(0.0f, dodge - vsk * 0.04f);
10355
10356 if (parry)
10357 parry = std::max(0.0f, parry - vsk * 0.04f);
10358
10359 if (block)
10360 block = std::max(0.0f, block - vsk * 0.04f);
10361
10362 if (vsk > 0)
10363 hitchance = std::max(hitchance, 95.0f + vsk * 0.02f + hitmodifier);
10364 else
10365 {
10366 if (pVictim->isPlayer())
10367 hitchance = std::max(hitchance, 95.0f + vsk * 0.1f + hitmodifier); //wowwiki multiplier - 0.04 but i think 0.1 more balanced
10368 else
10369 hitchance = std::max(hitchance, 100.0f + vsk * 0.6f + hitmodifier); //not wowwiki but more balanced
10370 }
10371
10372 if (ability != nullptr && castingSpell != nullptr)
10373 {
10374 applySpellModifiers(SPELLMOD_HITCHANCE, &hitchance, ability, castingSpell);
10375 }
10376
10377 if (ability && ability->getAttributes() & ATTRIBUTES_CANT_BE_DPB)
10378 {
10379 dodge = 0.0f;
10380 parry = 0.0f;
10381 block = 0.0f;
10382 }
10383
10384 //////////////////////////////////////////////////////////////////////////////////////////
10385 //One Roll Processing
10386 // cumulative chances generation
10387 float chances[4];
10388 chances[0] = std::max(0.0f, 100.0f - hitchance);
10389 chances[1] = chances[0] + dodge;
10390 chances[2] = chances[1] + parry;
10391 chances[3] = chances[2] + block;
10392
10393
10394 // roll
10395 float Roll = Util::getRandomFloat(100.0f);
10396 uint32_t r = 0;
10397
10398 while (r < 4 && Roll > chances[r])
10399 {
10400 r++;
10401 }
10402
10404 return roll_results[r];
10405}
@ ELITE_WORLDBOSS
@ EQUIPMENT_SLOT_MAINHAND
@ EQUIPMENT_SLOT_OFFHAND
@ EQUIPMENT_SLOT_RANGED
@ CR_WEAPON_SKILL_RANGED
@ CR_HIT_MELEE
@ CR_WEAPON_SKILL_OFFHAND
@ CR_DEFENSE_SKILL
@ CR_WEAPON_SKILL_MAINHAND
@ CR_HIT_RANGED
@ SKILL_UNARMED
Definition Skill.hpp:66
@ SKILL_FIST_WEAPONS
Definition Skill.hpp:139
@ SKILL_FERAL_COMBAT
Definition Skill.hpp:51
@ ATTRIBUTES_CANT_BE_DPB
@ SPELL_DID_HIT_MISS
@ SPELL_DID_HIT_SUCCESS
@ SPELL_DID_HIT_DODGE
@ SPELL_DID_HIT_BLOCK
@ SPELL_DID_HIT_PARRY
@ SPELLMOD_HITCHANCE
@ STAT_AGILITY
Definition Stats.h:34
@ FORM_DIREBEAR
@ FORM_CAT
@ FORM_BEAR
@ RANGED
@ OFFHAND
CreatureProperties const * GetCreatureProperties()
Item * GetInventoryItem(int16_t slot)
Gets a item from Inventory.
Definition Item.hpp:43
uint16_t getRequiredSkill() const
Definition Item.cpp:1492
bool isInFront(Object *target)
Definition Object.cpp:3766
ItemInterface * getItemInterface() const
Definition Player.cpp:6934
bool hasSpell(uint32_t spellId) const
Definition Player.cpp:3925
float calcRating(PlayerCombatRating t)
Definition Player.cpp:16170
bool m_isDisarmed
Definition Unit.hpp:1479
uint32_t getStat(uint8_t stat) const
Definition Unit.cpp:1448
float getHitFromMeleeSpell()
Definition Unit.hpp:1343
bool m_canParry
Definition Unit.hpp:1437
static void block(LexState *ls)
Definition lparser.c:1304
float getRandomFloat(float end)
Definition Random.cpp:44
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSpellImmunity()

uint32_t Unit::getSpellImmunity ( ) const

Definition at line 4525 of file Unit.cpp.

4526{
4527 return m_spellImmunityMask;
4528}
Here is the caller graph for this function:

◆ getStandState()

uint8_t Unit::getStandState ( ) const

Definition at line 1365 of file Unit.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getStandStateFlags()

uint8_t Unit::getStandStateFlags ( ) const

Definition at line 1390 of file Unit.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getStat()

uint32_t Unit::getStat ( uint8_t  stat) const

Definition at line 1448 of file Unit.cpp.

1448{ return unitData()->stat[stat]; }
std::array< uint32_t, WOWUNIT_STAT_COUNT > stat
Definition WoWUnit.hpp:137
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getStealthDetection()

int32_t Unit::getStealthDetection ( StealthFlag  flag) const

Definition at line 6190 of file Unit.cpp.

6191{
6192 return m_stealthDetection[flag];
6193}
int32_t m_stealthDetection[STEALTH_FLAG_TOTAL]
Definition Unit.hpp:933

◆ getStealthLevel()

int32_t Unit::getStealthLevel ( StealthFlag  flag) const

Definition at line 6185 of file Unit.cpp.

6186{
6187 return m_stealthLevel[flag];
6188}
int32_t m_stealthLevel[STEALTH_FLAG_TOTAL]
Definition Unit.hpp:932

◆ getSummonedByGuid()

uint64_t Unit::getSummonedByGuid ( ) const

Definition at line 394 of file Unit.cpp.

394{ return unitData()->summoned_by_guid.guid; };
guid_union summoned_by_guid
Definition WoWUnit.hpp:87
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSummonGuid()

uint64_t Unit::getSummonGuid ( ) const

Definition at line 383 of file Unit.cpp.

383{ return unitData()->summon_guid.guid; };
guid_union summon_guid
Definition WoWUnit.hpp:85
Here is the call graph for this function:

◆ getSummonInterface() [1/2]

SummonHandler * Unit::getSummonInterface ( )

Definition at line 7943 of file Unit.cpp.

7944{
7945 return m_summonInterface.get();
7946}
Here is the caller graph for this function:

◆ getSummonInterface() [2/2]

SummonHandler const * Unit::getSummonInterface ( ) const

Definition at line 7948 of file Unit.cpp.

7949{
7950 return m_summonInterface.get();
7951}

◆ getTaggerGuid()

uint64_t Unit::getTaggerGuid ( ) const

Definition at line 8120 of file Unit.cpp.

8121{
8122 return m_taggerGuid;
8123}
uint64_t m_taggerGuid
Definition Unit.hpp:1207
Here is the caller graph for this function:

◆ getTargetGuid()

uint64_t Unit::getTargetGuid ( ) const

Definition at line 400 of file Unit.cpp.

400{ return unitData()->target_guid.guid; };
guid_union target_guid
Definition WoWUnit.hpp:89
Here is the call graph for this function:

◆ getThreatManager() [1/2]

ThreatManager & Unit::getThreatManager ( )
inline

Definition at line 1190 of file Unit.hpp.

1190{ return m_threatManager; }
ThreatManager m_threatManager
Definition Unit.hpp:1183

◆ getThreatManager() [2/2]

ThreatManager const & Unit::getThreatManager ( ) const
inline

Definition at line 1191 of file Unit.hpp.

1191{ return m_threatManager; }

◆ getThreatModifyer()

int32_t Unit::getThreatModifyer ( )
inline

Definition at line 1197 of file Unit.hpp.

1197{ return m_threatModifyer; }
int32_t m_threatModifyer
Definition Unit.hpp:1186
Here is the caller graph for this function:

◆ getTotalFloatDamageForAuraEffect()

float_t Unit::getTotalFloatDamageForAuraEffect ( AuraEffect  aura_effect) const

Definition at line 4973 of file Unit.cpp.

4974{
4975 float_t totalDamage = 0.0f;
4976 for (const auto& aurEff : getAuraEffectList(aura_effect))
4977 totalDamage += aurEff->getEffectFloatDamage();
4978
4979 return totalDamage;
4980}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTotalFloatDamageForAuraEffectByMiscValue()

float_t Unit::getTotalFloatDamageForAuraEffectByMiscValue ( AuraEffect  aura_effect,
int32_t  miscValue 
) const

Definition at line 4982 of file Unit.cpp.

4983{
4984 float_t totalDamage = 0.0f;
4985 for (const auto& aurEff : getAuraEffectList(aura_effect))
4986 {
4987 if (aurEff->getEffectMiscValue() == miscValue)
4988 totalDamage += aurEff->getEffectFloatDamage();
4989 }
4990
4991 return totalDamage;
4992}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTotalIntDamageForAuraEffect()

int32_t Unit::getTotalIntDamageForAuraEffect ( AuraEffect  aura_effect) const

Definition at line 4952 of file Unit.cpp.

4953{
4954 int32_t totalDamage = 0;
4955 for (const auto& aurEff : getAuraEffectList(aura_effect))
4956 totalDamage += aurEff->getEffectDamage();
4957
4958 return totalDamage;
4959}
Here is the call graph for this function:

◆ getTotalIntDamageForAuraEffectByMiscValue()

int32_t Unit::getTotalIntDamageForAuraEffectByMiscValue ( AuraEffect  aura_effect,
int32_t  miscValue 
) const

Definition at line 4961 of file Unit.cpp.

4962{
4963 int32_t totalDamage = 0;
4964 for (const auto& aurEff : getAuraEffectList(aura_effect))
4965 {
4966 if (aurEff->getEffectMiscValue() == miscValue)
4967 totalDamage += aurEff->getEffectDamage();
4968 }
4969
4970 return totalDamage;
4971}
Here is the call graph for this function:

◆ getTotalPctMultiplierForAuraEffect()

float_t Unit::getTotalPctMultiplierForAuraEffect ( AuraEffect  aura_effect) const

Definition at line 4994 of file Unit.cpp.

4995{
4996 return 1.0f + (getTotalFloatDamageForAuraEffect(aura_effect) / 100.0f);
4997}
float_t getTotalFloatDamageForAuraEffect(AuraEffect aura_effect) const
Definition Unit.cpp:4973
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTotalPctMultiplierForAuraEffectByMiscValue()

float_t Unit::getTotalPctMultiplierForAuraEffectByMiscValue ( AuraEffect  aura_effect,
int32_t  miscValue 
) const

Definition at line 4999 of file Unit.cpp.

5000{
5001 return 1.0f + (getTotalFloatDamageForAuraEffectByMiscValue(aura_effect, miscValue) / 100.0f);
5002}
float_t getTotalFloatDamageForAuraEffectByMiscValue(AuraEffect aura_effect, int32_t miscValue) const
Definition Unit.cpp:4982
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTotalSpellModifiers()

template<typename T >
template void Unit::getTotalSpellModifiers< float_t > ( SpellModifierType  modType,
baseValue,
int32_t flatMod,
int32_t pctMod,
SpellInfo const spellInfo,
Spell castingSpell = nullptr,
Aura castingAura = nullptr,
bool  checkOnly = false 
)

Definition at line 4480 of file Unit.cpp.

4481{
4482 for (const auto& spellMod : m_spellModifiers[modType])
4483 {
4484 const auto modSpellInfo = spellMod->getAura()->getSpellInfo();
4485 if (modSpellInfo->getSpellFamilyName() != spellInfo->getSpellFamilyName())
4486 continue;
4487 if (!modSpellInfo->isEffectIndexAffectingSpell(spellMod->getEffectIndex(), spellInfo))
4488 continue;
4489
4490 if (spellMod->getAuraEffectType() == SPELL_AURA_ADD_FLAT_MODIFIER)
4491 {
4492 *flatMod += spellMod->getEffectDamage();
4493 }
4494 else
4495 {
4496 // Skip null values for pct mods
4497 if (baseValue == 0)
4498 continue;
4499
4500 *pctMod += spellMod->getEffectDamage();
4501 }
4502
4503 // Add the modifier
4504 if (!checkOnly)
4505 {
4506 if (castingSpell != nullptr)
4507 castingSpell->addUsedSpellModifier(spellMod);
4508 else if (castingAura != nullptr)
4509 castingAura->addUsedSpellModifier(spellMod);
4510 }
4511 }
4512}
@ SPELL_AURA_ADD_FLAT_MODIFIER
void addUsedSpellModifier(AuraEffectModifier const *aurEff)
void addUsedSpellModifier(AuraEffectModifier const *aurEff)
Definition Spell.cpp:5851
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTotem()

TotemSummon * Unit::getTotem ( SummonSlot  slot) const

Definition at line 7934 of file Unit.cpp.

7935{
7936 auto* const totem = m_summonInterface->getSummonInSlot(slot);
7937 if (totem == nullptr || !totem->isTotem())
7938 return nullptr;
7939
7940 return dynamic_cast<TotemSummon*>(totem);
7941}
Here is the caller graph for this function:

◆ getTransformAura()

uint32_t Unit::getTransformAura ( ) const

Definition at line 5561 of file Unit.cpp.

5562{
5563 return m_transformAura;
5564}
uint32_t m_transformAura
Definition Unit.hpp:901

◆ getTransGuid()

uint64_t Unit::getTransGuid ( )

Definition at line 7998 of file Unit.cpp.

7999{
8000#ifdef FT_VEHICLES
8001 if (getVehicle())
8002 return getVehicleBase()->getGuid();
8003#endif
8004 if (GetTransport())
8005 return GetTransport()->getGuid();
8006
8007 return 0;
8008}
Transporter * GetTransport() const
Definition Object.hpp:379
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getUnitFlags()

uint32_t Unit::getUnitFlags ( ) const

Definition at line 1107 of file Unit.cpp.

1107{ return unitData()->unit_flags; }
uint32_t unit_flags
Definition WoWUnit.hpp:109
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getUnitMovementFlags()

uint32_t Unit::getUnitMovementFlags ( ) const

Definition at line 1933 of file Unit.cpp.

1933{ return obj_movement_info.flags; }
Here is the caller graph for this function:

◆ getUnitStateFlags()

uint32_t Unit::getUnitStateFlags ( )
inline

Definition at line 719 of file Unit.hpp.

719{ return m_unitState; }
Here is the caller graph for this function:

◆ getVirtualItemSlotId()

uint32_t Unit::getVirtualItemSlotId ( uint8_t  slot) const

Definition at line 961 of file Unit.cpp.

961{ return unitData()->virtual_item_slot_display[slot]; }
std::array< uint32_t, WOWUNIT_VIRTUAL_ITEM_SLOT_DISPLAY_COUNT > virtual_item_slot_display
Definition WoWUnit.hpp:107
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getVisualAuraList()

VisualAuraArray const & Unit::getVisualAuraList ( ) const

Definition at line 5757 of file Unit.cpp.

5758{
5759 return m_auraVisualList;
5760}
Here is the caller graph for this function:

◆ giveGroupXP()

void Unit::giveGroupXP ( Unit unitVictim,
Player playerInGroup 
)

Definition at line 9420 of file Unit.cpp.

9421{
9422 if (!playerInGroup || !unitVictim || !playerInGroup->isInGroup())
9423 return;
9424
9425 auto group = playerInGroup->getGroup();
9426 if (!group)
9427 return;
9428
9429 Player* pHighLvlPlayer = nullptr;
9430 uint8_t activePlayerCount = 0;
9431 Player* activePlayerList[MAX_GROUP_SIZE_RAID];
9432 uint32_t totalLevel = 0;
9433
9434 group->Lock();
9435 for (uint32_t i = 0; i < group->GetSubGroupCount(); ++i)
9436 {
9437 for (auto subGroupMember : group->GetSubGroup(i)->getGroupMembers())
9438 {
9439 Player* player = sObjectMgr.getPlayer(subGroupMember->guid);
9440 if (player && player->isAlive() && unitVictim->getWorldMap() == player->getWorldMap() && player->getDistanceSq(unitVictim) < 100 * 100)
9441 {
9442 activePlayerList[activePlayerCount] = player;
9443 activePlayerCount++;
9444 totalLevel += player->getLevel();
9445
9446 if (pHighLvlPlayer)
9447 {
9448 if (player->getLevel() > pHighLvlPlayer->getLevel())
9449 pHighLvlPlayer = player;
9450 }
9451 else
9452 {
9453 pHighLvlPlayer = player;
9454 }
9455 }
9456 }
9457 }
9458 group->Unlock();
9459
9460 uint32_t xp;
9461 if (activePlayerCount < 1)
9462 {
9463 xp = CalculateXpToGive(unitVictim, playerInGroup);
9464 playerInGroup->giveXp(xp, unitVictim->getGuid(), true);
9465 }
9466 else
9467 {
9468 float xpMod = 1.0f;
9469 if (group->getGroupType() == GROUP_TYPE_PARTY)
9470 {
9471 if (activePlayerCount == 3)
9472 xpMod = 1.1666f;
9473 else if (activePlayerCount == 4)
9474 xpMod = 1.3f;
9475 else if (activePlayerCount == 5)
9476 xpMod = 1.4f;
9477 else
9478 xpMod = 1;
9479 }
9480 else if (group->getGroupType() == GROUP_TYPE_RAID)
9481 {
9482 xpMod = 0.5f;
9483 }
9484
9485 xp = CalculateXpToGive(unitVictim, pHighLvlPlayer);
9486
9487 for (uint8_t i = 0; i < activePlayerCount; i++)
9488 {
9489 Player* plr = activePlayerList[i];
9490 plr->giveXp(Util::float2int32(static_cast<float>(xp) * static_cast<float>(plr->getLevel()) / static_cast<float>(totalLevel) * xpMod), unitVictim->getGuid(), true);
9491
9493 if (!sEventMgr.HasEvent(activePlayerList[i], EVENT_LASTKILLWITHHONOR_FLAG_EXPIRE))
9494 {
9495 sEventMgr.AddEvent(static_cast<Unit*>(activePlayerList[i]), &Unit::removeAuraStateAndAuras,
9497 }
9498 else
9499 {
9500 sEventMgr.ModifyEventTimeLeft(activePlayerList[i], EVENT_LASTKILLWITHHONOR_FLAG_EXPIRE, 20000);
9501 }
9502
9503 if (plr->getPet() && plr->getPet()->canGainXp())
9504 {
9505 const auto petXP = static_cast<uint32_t>(static_cast<float>(CalculateXpToGive(unitVictim, plr->getPet())) * xpMod);
9506 if (petXP > 0)
9507 plr->getPet()->giveXp(petXP);
9508 }
9509 }
9510 }
9511}
@ AURASTATE_FLAG_LASTKILLWITHHONOR
@ EVENT_LASTKILLWITHHONOR_FLAG_EXPIRE
Definition EventMgr.h:71
@ MAX_GROUP_SIZE_RAID
Definition Group.h:42
@ GROUP_TYPE_RAID
Definition Group.h:33
@ GROUP_TYPE_PARTY
Definition Group.h:31
uint32_t CalculateXpToGive(Unit *pVictim, Unit *pAttacker)
Definition Stats.cpp:191
float getDistanceSq(LocationVector target) const
Definition Object.cpp:588
bool canGainXp() const
Definition Pet.cpp:535
void giveXp(uint32_t xp)
Definition Pet.cpp:490
Group * getGroup()
Definition Player.cpp:7887
bool isInGroup() const
Definition Player.cpp:7885
void giveXp(uint32_t xp, const uint64_t &guid, bool allowBonus)
Definition Player.cpp:12133
Pet * getPet() const
Definition Unit.cpp:7929
Here is the call graph for this function:

◆ handleFall()

void Unit::handleFall ( MovementInfo const movementInfo)

Definition at line 2500 of file Unit.cpp.

2501{
2502 if (!m_zAxisPosition)
2503 m_zAxisPosition = movementInfo.getPosition()->z;
2504
2505 uint32_t falldistance = Util::float2int32(m_zAxisPosition - movementInfo.getPosition()->z);
2506 if (m_zAxisPosition <= movementInfo.getPosition()->z)
2507 falldistance = 1;
2508
2509 if (static_cast<int>(falldistance) > m_safeFall)
2510 falldistance -= m_safeFall;
2511 else
2512 falldistance = 1;
2513
2514 bool disabledUntil = false;
2515 if (isPlayer())
2516 disabledUntil = !dynamic_cast<Player*>(this)->m_cheats.hasGodModeCheat && UNIXTIME >= dynamic_cast<Player*>(this)->getFallDisabledUntil();
2517
2518 if (isAlive() && !m_isInvincible && (falldistance > 12) && !m_noFallDamage && disabledUntil)
2519 {
2520 auto health_loss = static_cast<uint32_t>(getHealth() * (falldistance - 12) * 0.017f);
2521 if (health_loss >= getHealth())
2522 {
2523 health_loss = getHealth();
2524 }
2525#if VERSION_STRING > TBC
2526 else if ((falldistance >= 65))
2527 {
2528 if (isPlayer())
2529 {
2530 dynamic_cast<Player*>(this)->updateAchievementCriteria(
2531 ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING,
2532 falldistance,
2533 dynamic_cast<Player*>(this)->getDrunkStateByValue(dynamic_cast<Player*>(this)->getServersideDrunkValue()),
2534 0);
2535 }
2536 }
2537#endif
2538
2541 }
2542
2543 m_zAxisPosition = 0.0f;
2544}
@ DAMAGE_FALL
time_t getFallDisabledUntil() const
Definition Player.cpp:2047
static PlayerBytes3_DrunkValue getDrunkStateByValue(uint16_t value)
Definition Player.cpp:11851
bool m_noFallDamage
Definition Unit.hpp:614
void sendEnvironmentalDamageLogPacket(uint64_t guid, uint8_t type, uint32_t damage, uint64_t unk=0)
Definition Unit.cpp:6935
int32_t m_safeFall
Definition Unit.hpp:613
void addSimpleEnvironmentalDamageBatchEvent(EnviromentalDamage type, uint32_t damage, uint32_t absorbedDamage=0)
Definition Unit.cpp:7381
float m_zAxisPosition
Definition Unit.hpp:612
SERVER_DECL time_t UNIXTIME
Definition Log.cpp:17
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleKnockback()

void Unit::handleKnockback ( Object caster,
float  horizontal,
float  vertical 
)
virtual

Reimplemented in Player.

Definition at line 3331 of file Unit.cpp.

3332{
3333 if (object == nullptr)
3334 object = this;
3335
3336 float angle = calcRadAngle(object->GetPositionX(), object->GetPositionY(), GetPositionX(), GetPositionY());
3337 if (object == this)
3338 angle = static_cast<float>(M_PI + GetOrientation());
3339
3340 float destx, desty, destz;
3341 if (GetPoint(angle, horizontal, destx, desty, destz, true))
3342 getMovementManager()->moveKnockbackFrom(destx, desty, horizontal, vertical);
3343}
void moveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ)
bool GetPoint(float angle, float rad, float &outx, float &outy, float &outz, bool sloppypath=false)
Definition Object.cpp:4661
float calcRadAngle(float Position1X, float Position1Y, float Position2X, float Position2Y)
Definition Object.cpp:3700
MovementManager * getMovementManager()
Definition Unit.hpp:655
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleProc()

uint32_t Unit::handleProc ( uint32_t  flag,
Unit Victim,
SpellInfo const CastingSpell,
DamageInfo  damageInfo,
bool  isSpellTriggered,
ProcEvents  procEvent = PROC_EVENT_DO_ALL,
Aura triggeredFromAura = nullptr 
)

! The weird thing is that we need the spell that triggered this enchant spell in order to output logs ..we are using oldspell info too

Definition at line 11606 of file Unit.cpp.

11607{
11608 if (flag == 0)
11609 return 0;
11610
11611 uint32_t resisted_dmg = 0;
11612 bool can_delete = !m_isProcInUse; //if this is a nested proc then we should have this set to TRUE by the father proc
11613 m_isProcInUse = true; //locking the proc list
11614
11615 std::list<SpellProc*> happenedProcs;
11616
11617 for (auto itr = m_procSpells.begin(); itr != m_procSpells.end();) // Proc Trigger Spells for Victim
11618 {
11619 auto itr2 = itr++;
11620 SpellProc* spell_proc = itr2->get();
11621
11622 // Check if list item was deleted elsewhere, so here it's removed and freed
11623 if (spell_proc->isDeleted())
11624 {
11625 if (can_delete)
11626 {
11627 m_procSpells.erase(itr2);
11628 }
11629 continue;
11630 }
11631
11632 // APGL End
11633 // MIT Start
11634
11635 // Check if spell proc is marked to skip this call
11636 if (spell_proc->isSkippingHandleProc())
11637 {
11638 spell_proc->skipOnNextHandleProc(false);
11639 continue;
11640 }
11641
11642 if (CastingSpell != nullptr)
11643 {
11644 // A spell cannot proc itself
11645 if (CastingSpell->getId() == spell_proc->getSpell()->getId())
11646 continue;
11647
11648 // Check proc class mask
11649 if (!spell_proc->checkClassMask(CastingSpell))
11650 continue;
11651 }
11652
11653 if (procEvent == PROC_EVENT_DO_CASTER_PROCS_ONLY && !spell_proc->isCastedOnProcOwner())
11654 continue;
11655
11656 if (procEvent == PROC_EVENT_DO_TARGET_PROCS_ONLY && spell_proc->isCastedOnProcOwner())
11657 continue;
11658
11659 // Check proc flags
11660 if (!sScriptMgr.callScriptedSpellCheckProcFlags(spell_proc, static_cast<SpellProcFlags>(flag)))
11661 continue;
11662
11663 // Check extra proc flags
11664 if (!spell_proc->checkExtraProcFlags(this, damageInfo))
11665 continue;
11666
11667 // Check if this proc can happen
11668 if (!sScriptMgr.callScriptedSpellCanProc(spell_proc, victim, CastingSpell, damageInfo))
11669 continue;
11670 if (!spell_proc->canProc(victim, CastingSpell))
11671 continue;
11672
11673 if (CastingSpell != nullptr)
11674 {
11675 // Check if this proc can trigger on already triggered spell
11676 // by default procs can't
11677 if (isSpellTriggered && !sScriptMgr.callScriptedSpellCanProcOnTriggered(spell_proc, victim, CastingSpell, triggeredFromAura))
11678 continue;
11679 }
11680
11681 const auto spe = spell_proc->getSpell();
11682 // Spell id which is going to proc
11683 auto spellId = spe->getId();
11684
11685 // Get spellinfo of the spell that created this proc
11686 uint32_t origId = 0;
11687 if (spell_proc->getOriginalSpell() != nullptr)
11688 origId = spell_proc->getOriginalSpell()->getId();
11689
11690 // No need to check if exists or not since we were not able to register this trigger if it would not exist :P
11691 const auto ospinfo = spell_proc->getOriginalSpell();
11692
11693 auto proc_Chance = sScriptMgr.callScriptedSpellCalcProcChance(spell_proc, victim, CastingSpell);
11694
11695 // Check if spell proc uses procs-per-minute system
11696 if (isPlayer())
11697 {
11698 // Procs-per-minute, or PPM, amount describes how many procs (on average) can occur in one minute
11699 // To calculate Proc-chance-Per-Hit, or PPH, formula is:
11700 // unmodified weapon speed * PPM / 60
11701 auto ppmAmount = spell_proc->getProcsPerMinute();
11702 const auto plr = static_cast<Player*>(this);
11703
11704 // Old hackfixes
11705 switch (spellId)
11706 {
11707 //SPELL_HASH_BLACK_TEMPLE_MELEE_TRINKET
11708 case 40475:
11709 ppmAmount = 1.0f;
11710 break;
11711 // SPELL_HASH_MAGTHERIDON_MELEE_TRINKET:
11712 case 34774:
11713 ppmAmount = 1.5f;
11714 break; // dragonspine trophy
11715 // SPELL_HASH_ROMULO_S_POISON:
11716 case 34586:
11717 case 34587:
11718 ppmAmount = 1.5f;
11719 break; // romulo's
11720 // SPELL_HASH_FROSTBRAND_ATTACK:
11721 case 8034:
11722 case 8037:
11723 case 10458:
11724 case 16352:
11725 case 16353:
11726 case 25501:
11727 case 38617:
11728 case 54609:
11729 case 58797:
11730 case 58798:
11731 case 58799:
11732 case 64186:
11733 ppmAmount = 9.0f;
11734 break; // Frostbrand Weapon
11735 case 16870:
11736 ppmAmount = 2.0f;
11737 break; //druid: clearcasting
11738 default:
11739 break;
11740 }
11741
11742 // Default value is 0.0
11743 if (ppmAmount != 0.0f)
11744 {
11745 // Unarmed speed is 2 sec
11746 uint32_t weaponSpeed = 2000;
11747 if (plr->isInFeralForm())
11748 {
11749#if VERSION_STRING > Classic
11750 // Get shapeshift form's attack speed
11751 const auto form = sSpellShapeshiftFormStore.lookupEntry(plr->getShapeShiftForm());
11752 if (form != nullptr && form->AttackSpeed != 0)
11753 weaponSpeed = form->AttackSpeed;
11754#endif
11755 }
11756 else
11757 {
11758 switch (damageInfo.weaponType)
11759 {
11760 case MELEE:
11761 {
11762 const auto mainHand = plr->getItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_MAINHAND);
11763 if (mainHand != nullptr && mainHand->isWeapon())
11764 weaponSpeed = mainHand->getItemProperties()->Delay;
11765 } break;
11766 case OFFHAND:
11767 {
11768 const auto offHand = plr->getItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_OFFHAND);
11769 if (offHand != nullptr && offHand->isWeapon())
11770 weaponSpeed = offHand->getItemProperties()->Delay;
11771 } break;
11772 case RANGED:
11773 {
11774 const auto ranged = plr->getItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_RANGED);
11775 if (ranged != nullptr && ranged->isWeapon())
11776 weaponSpeed = ranged->getItemProperties()->Delay;
11777 } break;
11778 default:
11779 break;
11780 }
11781 }
11782
11783 proc_Chance = Util::float2int32((weaponSpeed * 0.001f * ppmAmount / 60.0f) * 100.0f);
11784 }
11785 }
11786
11787 // Apply modifiers to proc chance
11788 // todo: this will not use spell charges
11789 applySpellModifiers(SPELLMOD_TRIGGER, &proc_Chance, ospinfo);
11790
11791 if (!Util::checkChance(proc_Chance))
11792 continue;
11793
11794 // Check if proc has interval
11795 if (spell_proc->getProcInterval() > 0)
11796 {
11797 // Check for cooldown cheat
11798 if (!(spell_proc->getProcOwner()->isPlayer() && static_cast<Player*>(spell_proc->getProcOwner())->m_cheats.hasCooldownCheat))
11799 {
11800 const auto timeNow = Util::getMSTime();
11801 if (spell_proc->getLastTriggerTime() + spell_proc->getProcInterval() > timeNow)
11802 continue;
11803
11804 spell_proc->setLastTriggerTime(timeNow);
11805 }
11806 }
11807
11808 // MIT End
11809 // APGL Start
11810
11811#if VERSION_STRING >= TBC
11812 // SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
11813 for (uint8_t i = 0; i < 3; ++i)
11814 {
11815 if (ospinfo && ospinfo->getEffectApplyAuraName(i) == SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE)
11816 {
11817 spell_proc->setOverrideEffectDamage(i, ospinfo->getEffectBasePoints(i) + 1);
11818 sScriptMgr.callScriptedSpellProcDoEffect(spell_proc, victim, CastingSpell, damageInfo);
11819 spell_proc->doEffect(victim, CastingSpell, flag, damageInfo.realDamage, damageInfo.absorbedDamage, damageInfo.weaponType);
11820 }
11821 }
11822#endif
11823
11824 // give spell_proc a chance to handle the effect
11825 const auto scriptResult = sScriptMgr.callScriptedSpellProcDoEffect(spell_proc, victim, CastingSpell, damageInfo);
11826 if (scriptResult == SpellScriptExecuteState::EXECUTE_PREVENT)
11827 continue;
11828 if (spell_proc->doEffect(victim, CastingSpell, flag, damageInfo.realDamage, damageInfo.absorbedDamage, damageInfo.weaponType))
11829 continue;
11830
11831 //these are player talents. Fuckem they pull the emu speed down
11832 if (isPlayer())
11833 {
11834 uint32_t talentlevel = 0;
11835 switch (origId)
11836 {
11837 //mace specialization
11838 case 12284:
11839 {talentlevel = 1; }
11840 break;
11841 case 12701:
11842 {talentlevel = 2; }
11843 break;
11844 case 12702:
11845 {talentlevel = 3; }
11846 break;
11847 case 12703:
11848 {talentlevel = 4; }
11849 break;
11850 case 12704:
11851 {talentlevel = 5; }
11852 break;
11853
11854 //Unbridled Wrath
11855 case 12332:
11856 {talentlevel = 1; }
11857 break;
11858 case 12999:
11859 {talentlevel = 2; }
11860 break;
11861 case 13000:
11862 {talentlevel = 3; }
11863 break;
11864 case 13001:
11865 {talentlevel = 4; }
11866 break;
11867 case 13002:
11868 {talentlevel = 5; }
11869 break;
11870 }
11871
11872 switch (spellId)
11873 {
11874 case 32747: //Deadly Throw Interrupt (rogue arena gloves set)
11875 {
11876 if (CastingSpell == NULL)
11877 continue;
11878
11879 switch (CastingSpell->getId())
11880 {
11881 case 26679:
11882 case 37074:
11883 case 48673:
11884 case 48674:
11885 case 52885:
11886 case 59180:
11887 case 64499:
11888 break;
11889 default:
11890 continue;
11891 }
11892 }
11893 break;
11894 case 16959: //Druid - Primal Fury Proc
11895 {
11896 if (!isPlayer())
11897 continue;
11898 Player* p = static_cast<Player*>(this);
11900 continue;
11901 }
11902 break;
11903 case 16953: //Druid - Blood Frenzy Proc
11904 {
11905 if (!isPlayer() || !CastingSpell)
11906 continue;
11907
11908 Player* p = static_cast<Player*>(this);
11909 if (p->getShapeShiftForm() != FORM_CAT)
11910 continue;
11911
11912 switch (CastingSpell->getId())
11913 {
11914 //SPELL_HASH_SHRED
11915 case 3252:
11916 case 5221:
11917 case 6800:
11918 case 8992:
11919 case 9829:
11920 case 9830:
11921 case 27001:
11922 case 27002:
11923 case 27555:
11924 case 48571:
11925 case 48572:
11926 case 49121:
11927 case 49165:
11928 case 61548:
11929 case 61549:
11930 //SPELL_HASH_RAVAGE
11931 case 3242:
11932 case 3446:
11933 case 6785:
11934 case 6787:
11935 case 8391:
11936 case 9866:
11937 case 9867:
11938 case 24213:
11939 case 24333:
11940 case 27005:
11941 case 29906:
11942 case 33781:
11943 case 48578:
11944 case 48579:
11945 case 50518:
11946 case 53558:
11947 case 53559:
11948 case 53560:
11949 case 53561:
11950 case 53562:
11951 //SPELL_HASH_CLAW
11952 case 1082:
11953 case 2975:
11954 case 2976:
11955 case 2977:
11956 case 2980:
11957 case 2981:
11958 case 2982:
11959 case 3009:
11960 case 3010:
11961 case 3029:
11962 case 3666:
11963 case 3667:
11964 case 5201:
11965 case 9849:
11966 case 9850:
11967 case 16827:
11968 case 16828:
11969 case 16829:
11970 case 16830:
11971 case 16831:
11972 case 16832:
11973 case 24187:
11974 case 27000:
11975 case 27049:
11976 case 27347:
11977 case 31289:
11978 case 47468:
11979 case 48569:
11980 case 48570:
11981 case 51772:
11982 case 52471:
11983 case 52472:
11984 case 62225:
11985 case 67774:
11986 case 67793:
11987 case 67879:
11988 case 67980:
11989 case 67981:
11990 case 67982:
11991 case 75159:
11992 //SPELL_HASH_RAKE
11993 case 1822:
11994 case 1823:
11995 case 1824:
11996 case 9904:
11997 case 24331:
11998 case 24332:
11999 case 27003:
12000 case 27556:
12001 case 27638:
12002 case 36332:
12003 case 48573:
12004 case 48574:
12005 case 53499:
12006 case 54668:
12007 case 59881:
12008 case 59882:
12009 case 59883:
12010 case 59884:
12011 case 59885:
12012 case 59886:
12013 break;
12014 default:
12015 continue;
12016 }
12017 }
12018 break;
12019 case 14189: //Seal Fate
12020 {
12021 if (!this->isPlayer() || !CastingSpell || CastingSpell->getId() == 14189 || CastingSpell->getId() == 16953 || CastingSpell->getId() == 16959)
12022 continue;
12023 if (CastingSpell->getEffect(0) != SPELL_EFFECT_ADD_COMBO_POINTS && CastingSpell->getEffect(1) != SPELL_EFFECT_ADD_COMBO_POINTS &&
12024 CastingSpell->getEffect(2) != SPELL_EFFECT_ADD_COMBO_POINTS)
12025 {
12026 switch (CastingSpell->getId())
12027 {
12028 case 33876:
12029 case 33982:
12030 case 33983:
12031 case 48565:
12032 case 48566:
12033 break;
12034 default:
12035 continue;
12036 }
12037 }
12038 }
12039 break;
12040 case 17106: //druid intensity
12041 {
12042 if (CastingSpell == NULL)
12043 continue;
12044 if (CastingSpell->getId() != 5229) //enrage
12045 continue;
12046 }
12047 break;
12048 case 31616: //Nature's Guardian
12049 {
12050 //yep, another special case: Nature's grace
12051 if (getHealthPct() > 30)
12052 continue;
12053 }
12054 break;
12055 case 37309: //Bloodlust
12056 {
12057 if (!this->isPlayer())
12058 continue;
12059 if (this->getShapeShiftForm() != FORM_BEAR &&
12061 continue;
12062 }
12063 break;
12064 case 37310://Bloodlust
12065 {
12066 if (!this->isPlayer() || this->getShapeShiftForm() != FORM_CAT)
12067 continue;
12068 }
12069 break;
12070 case 16459:
12071 {
12072 //sword specialization
12073 Item* item_mainhand = static_cast<Player*>(this)->getItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_MAINHAND);
12074 Item* item_offhand = static_cast<Player*>(this)->getItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_OFFHAND);
12075 uint16_t reqskillMH = 0;
12076 uint16_t reqskillOH = 0;
12077
12078 if (item_mainhand != nullptr)
12079 reqskillMH = item_mainhand->getRequiredSkill();
12080
12081 if (item_offhand != nullptr)
12082 reqskillOH = item_offhand->getRequiredSkill();
12083
12084 if (reqskillMH != SKILL_SWORDS && reqskillMH != SKILL_2H_SWORDS && reqskillOH != SKILL_SWORDS && reqskillOH != SKILL_2H_SWORDS)
12085 continue;
12086 }
12087 break;
12088 case 12721:
12089 {
12090 //deep wound requires a melee weapon
12091 auto item = static_cast<Player*>(this)->getItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_MAINHAND);
12092 if (item)
12093 {
12094 //class 2 means weapons ;)
12095 if (item->getItemProperties()->Class != 2)
12096 continue;
12097 }
12098 else continue; //no weapon no joy
12099 }
12100 break;
12101 //Warrior - Sword and Board
12102 case 50227:
12103 {
12104 if (CastingSpell == NULL)
12105 continue;
12106
12107 switch (CastingSpell->getId())
12108 {
12109 //SPELL_HASH_REVENGE
12110 case 6572:
12111 case 6574:
12112 case 7379:
12113 case 11600:
12114 case 11601:
12115 case 12170:
12116 case 19130:
12117 case 25269:
12118 case 25288:
12119 case 28844:
12120 case 30357:
12121 case 37517:
12122 case 40392:
12123 case 57823:
12124 //SPELL_HASH_DEVASTATE
12125 case 20243:
12126 case 30016:
12127 case 30017:
12128 case 30022:
12129 case 36891:
12130 case 36894:
12131 case 38849:
12132 case 38967:
12133 case 44452:
12134 case 47497:
12135 case 47498:
12136 case 57795:
12137 case 60018:
12138 case 62317:
12139 case 69902:
12140 break;
12141 default:
12142 continue;
12143 }
12144 } break;
12145
12146 //Warrior - Safeguard
12147 case 46946:
12148 case 46947:
12149 {
12150 if (CastingSpell == NULL)
12151 continue;
12152
12153 switch (CastingSpell->getId())
12154 {
12155 //SPELL_HASH_INTERVENE
12156 case 3411:
12157 case 34784:
12158 case 41198:
12159 case 53476:
12160 case 59667:
12161 break;
12162 default:
12163 continue;
12164 }
12165 }
12166 break;
12167 //Warrior - Taste for Blood
12168 case 60503:
12169 {
12170 switch (CastingSpell->getId())
12171 {
12172 //SPELL_HASH_REND
12173 case 772:
12174 case 6546:
12175 case 6547:
12176 case 6548:
12177 case 11572:
12178 case 11573:
12179 case 11574:
12180 case 11977:
12181 case 12054:
12182 case 13318:
12183 case 13443:
12184 case 13445:
12185 case 13738:
12186 case 14087:
12187 case 14118:
12188 case 16393:
12189 case 16403:
12190 case 16406:
12191 case 16509:
12192 case 17153:
12193 case 17504:
12194 case 18075:
12195 case 18078:
12196 case 18106:
12197 case 18200:
12198 case 18202:
12199 case 21949:
12200 case 25208:
12201 case 29574:
12202 case 29578:
12203 case 36965:
12204 case 36991:
12205 case 37662:
12206 case 43246:
12207 case 43931:
12208 case 46845:
12209 case 47465:
12210 case 48880:
12211 case 53317:
12212 case 54703:
12213 case 54708:
12214 case 59239:
12215 case 59343:
12216 case 59691:
12217 break;
12218 default:
12219 continue;
12220 }
12221 }
12222 break;
12223 //Warrior - Unbridled Wrath
12224 case 12964:
12225 {
12226 //let's recalc chance to cast since we have a full 100 all time on this one
12227 Item* it = static_cast<Player*>(this)->getItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_MAINHAND);
12228 if (it == nullptr)
12229 continue; //no weapon no joy
12230 //float chance=float(it->GetProto()->Delay)*float(talentlevel)/600.0f;
12231 uint32_t chance = it->getItemProperties()->Delay * talentlevel / 300; //zack this had a very low proc rate. Kinda like a wasted talent
12232 uint32_t myroll = Util::getRandomUInt(100);
12233 if (myroll > chance)
12234 continue;
12235 }
12236 break;
12237 //Warrior - Gag Order
12238 case 18498:
12239 {
12240 if (CastingSpell == NULL)
12241 continue;
12242
12243 switch (CastingSpell->getId())
12244 {
12245 //SPELL_HASH_SHIELD_BASH
12246 case 72:
12247 case 1671:
12248 case 1672:
12249 case 11972:
12250 case 29704:
12251 case 33871:
12252 case 35178:
12253 case 36988:
12254 case 38233:
12255 case 41180:
12256 case 41197:
12257 case 70964:
12258 case 72194:
12259 case 72196:
12260 //SPELL_HASH_HEROIC_THROW
12261 case 57755:
12262 break;
12263 default:
12264 continue;
12265 }
12266 }
12267 break;
12268 //Warrior - Bloodsurge
12269 case 46916:
12270 {
12271 if (CastingSpell == NULL)
12272 continue;
12273
12274 switch (CastingSpell->getId())
12275 {
12276 case 23881:
12277 //SPELL_HASH_WHIRLWIND
12278 case 1680:
12279 case 8989:
12280 case 9633:
12281 case 13736:
12282 case 15576:
12283 case 15577:
12284 case 15578:
12285 case 15589:
12286 case 17207:
12287 case 24236:
12288 case 26038:
12289 case 26083:
12290 case 26084:
12291 case 26686:
12292 case 28334:
12293 case 28335:
12294 case 29573:
12295 case 29851:
12296 case 29852:
12297 case 31737:
12298 case 31738:
12299 case 31909:
12300 case 31910:
12301 case 33238:
12302 case 33239:
12303 case 33500:
12304 case 36132:
12305 case 36142:
12306 case 36175:
12307 case 36981:
12308 case 36982:
12309 case 37582:
12310 case 37583:
12311 case 37640:
12312 case 37641:
12313 case 37704:
12314 case 38618:
12315 case 38619:
12316 case 39232:
12317 case 40236:
12318 case 40653:
12319 case 40654:
12320 case 41056:
12321 case 41057:
12322 case 41058:
12323 case 41059:
12324 case 41061:
12325 case 41097:
12326 case 41098:
12327 case 41194:
12328 case 41195:
12329 case 41399:
12330 case 41400:
12331 case 43442:
12332 case 44949:
12333 case 45895:
12334 case 45896:
12335 case 46270:
12336 case 46271:
12337 case 48280:
12338 case 48281:
12339 case 49807:
12340 case 50228:
12341 case 50229:
12342 case 50622:
12343 case 52027:
12344 case 52028:
12345 case 52977:
12346 case 54797:
12347 case 55266:
12348 case 55267:
12349 case 55463:
12350 case 55977:
12351 case 56408:
12352 case 59322:
12353 case 59323:
12354 case 59549:
12355 case 59550:
12356 case 61076:
12357 case 61078:
12358 case 61136:
12359 case 61137:
12360 case 61139:
12361 case 63805:
12362 case 63806:
12363 case 63807:
12364 case 63808:
12365 case 65510:
12366 case 67037:
12367 case 67716:
12368 //SPELL_HASH_HEROIC_STRIKE
12369 case 78:
12370 case 284:
12371 case 285:
12372 case 1608:
12373 case 11564:
12374 case 11565:
12375 case 11566:
12376 case 11567:
12377 case 25286:
12378 case 25710:
12379 case 25712:
12380 case 29426:
12381 case 29567:
12382 case 29707:
12383 case 30324:
12384 case 31827:
12385 case 41975:
12386 case 45026:
12387 case 47449:
12388 case 47450:
12389 case 52221:
12390 case 53395:
12391 case 57846:
12392 case 59035:
12393 case 59607:
12394 case 62444:
12395 case 69566:
12396 break;
12397 default:
12398 continue;
12399 }
12400 } break;
12401
12402 ////////////////////////////////////////////////////////////////////////////
12403 // Mage ignite talent only for fire dmg
12404 case 12654:
12405 {
12406 if (CastingSpell == NULL)
12407 continue;
12408 if (!(CastingSpell->getSchoolMask() & SCHOOL_MASK_FIRE))
12409 continue;
12410 const auto spellInfo = sSpellMgr.getSpellInfo(spellId); //we already modified this spell on server loading so it must exist
12411 auto spell_duration = sSpellDurationStore.lookupEntry(spellInfo->getDurationIndex());
12412 uint32_t tickcount = GetDuration(spell_duration) / spellInfo->getEffectAmplitude(0);
12413
12414 if (ospinfo)
12415 spell_proc->setOverrideEffectDamage(0, ospinfo->getEffectBasePoints(0) * damageInfo.realDamage / (100 * tickcount));
12416 }
12417 break;
12418 //druid - Primal Fury
12419 case 37116:
12420 case 37117:
12421 {
12422 if (!this->isPlayer())
12423 continue;
12424 Player* mPlayer = static_cast<Player*>(this);
12425 if (!mPlayer->isInFeralForm() ||
12426 (mPlayer->getShapeShiftForm() != FORM_CAT &&
12427 mPlayer->getShapeShiftForm() != FORM_BEAR &&
12428 mPlayer->getShapeShiftForm() != FORM_DIREBEAR))
12429 continue;
12430 }
12431 break;
12432 //rogue - blade twisting
12433 case 31125:
12434 {
12435 if (CastingSpell == NULL)
12436 continue;//this should not occur unless we made a fuckup somewhere
12437
12438 //only trigger effect for specified spells
12439 switch (CastingSpell->getId())
12440 {
12441 //SPELL_HASH_SINISTER_STRIKE
12442 case 1752:
12443 case 1757:
12444 case 1758:
12445 case 1759:
12446 case 1760:
12447 case 8621:
12448 case 11293:
12449 case 11294:
12450 case 14873:
12451 case 15581:
12452 case 15667:
12453 case 19472:
12454 case 26861:
12455 case 26862:
12456 case 46558:
12457 case 48637:
12458 case 48638:
12459 case 57640:
12460 case 59409:
12461 case 60195:
12462 case 69920:
12463 case 71145:
12464 //SPELL_HASH_SHIV
12465 case 5938:
12466 case 5940:
12467 //SPELL_HASH_BACKSTAB
12468 case 53:
12469 case 2589:
12470 case 2590:
12471 case 2591:
12472 case 7159:
12473 case 8721:
12474 case 11279:
12475 case 11280:
12476 case 11281:
12477 case 15582:
12478 case 15657:
12479 case 22416:
12480 case 25300:
12481 case 26863:
12482 case 30992:
12483 case 34614:
12484 case 37685:
12485 case 48656:
12486 case 48657:
12487 case 52540:
12488 case 58471:
12489 case 63754:
12490 case 71410:
12491 case 72427:
12492 //SPELL_HASH_GOUGE
12493 case 1776:
12494 case 1777:
12495 case 8629:
12496 case 11285:
12497 case 11286:
12498 case 12540:
12499 case 13579:
12500 case 24698:
12501 case 28456:
12502 case 29425:
12503 case 34940:
12504 case 36862:
12505 case 38764:
12506 case 38863:
12507 break;
12508 default:
12509 continue;
12510 }
12511 }
12512 break;
12513 //priest - Grace
12514 case 47930:
12515 {
12516 if (CastingSpell == NULL)
12517 continue;
12518
12519 switch (CastingSpell->getId())
12520 {
12521 //SPELL_HASH_PENANCE
12522 case 47540:
12523 case 47666:
12524 case 47750:
12525 case 47757:
12526 case 47758:
12527 case 52983:
12528 case 52984:
12529 case 52985:
12530 case 52986:
12531 case 52987:
12532 case 52988:
12533 case 52998:
12534 case 52999:
12535 case 53000:
12536 case 53001:
12537 case 53002:
12538 case 53003:
12539 case 53005:
12540 case 53006:
12541 case 53007:
12542 case 54518:
12543 case 54520:
12544 case 66097:
12545 case 66098:
12546 case 68029:
12547 case 68030:
12548 case 68031:
12549 case 69905:
12550 case 69906:
12551 case 71137:
12552 case 71138:
12553 case 71139:
12554 //SPELL_HASH_FLASH_HEAL
12555 case 2061:
12556 case 9472:
12557 case 9473:
12558 case 9474:
12559 case 10915:
12560 case 10916:
12561 case 10917:
12562 case 17137:
12563 case 17138:
12564 case 17843:
12565 case 25233:
12566 case 25235:
12567 case 27608:
12568 case 38588:
12569 case 42420:
12570 case 43431:
12571 case 43516:
12572 case 43575:
12573 case 48070:
12574 case 48071:
12575 case 56331:
12576 case 56919:
12577 case 66104:
12578 case 68023:
12579 case 68024:
12580 case 68025:
12581 case 71595:
12582 case 71782:
12583 case 71783:
12584 //SPELL_HASH_GREATER_HEAL
12585 case 2060:
12586 case 10963:
12587 case 10964:
12588 case 10965:
12589 case 22009:
12590 case 25210:
12591 case 25213:
12592 case 25314:
12593 case 28809:
12594 case 29564:
12595 case 34119:
12596 case 35096:
12597 case 38580:
12598 case 41378:
12599 case 48062:
12600 case 48063:
12601 case 49348:
12602 case 57775:
12603 case 60003:
12604 case 61965:
12605 case 62334:
12606 case 62442:
12607 case 63760:
12608 case 69963:
12609 case 71131:
12610 case 71931:
12611 break;
12612 default:
12613 continue;
12614 }
12615 }
12616 break;
12617 //warlock - Improved Shadow Bolt
12618 case 17794:
12619 case 17798:
12620 case 17797:
12621 case 17799:
12622 case 17800:
12623 {
12624 if (CastingSpell == NULL)
12625 continue;//this should not occur unless we made a fuckup somewhere
12626
12627 //only trigger effect for specified spells
12628 switch (CastingSpell->getId())
12629 {
12630 //SPELL_HASH_SHADOW_BOLT
12631 case 686:
12632 case 695:
12633 case 705:
12634 case 1088:
12635 case 1106:
12636 case 7617:
12637 case 7619:
12638 case 7641:
12639 case 9613:
12640 case 11659:
12641 case 11660:
12642 case 11661:
12643 case 12471:
12644 case 12739:
12645 case 13440:
12646 case 13480:
12647 case 14106:
12648 case 14122:
12649 case 15232:
12650 case 15472:
12651 case 15537:
12652 case 16408:
12653 case 16409:
12654 case 16410:
12655 case 16783:
12656 case 16784:
12657 case 17393:
12658 case 17434:
12659 case 17435:
12660 case 17483:
12661 case 17509:
12662 case 18111:
12663 case 18138:
12664 case 18164:
12665 case 18205:
12666 case 18211:
12667 case 18214:
12668 case 18217:
12669 case 19728:
12670 case 19729:
12671 case 20298:
12672 case 20791:
12673 case 20807:
12674 case 20816:
12675 case 20825:
12676 case 21077:
12677 case 21141:
12678 case 22336:
12679 case 22677:
12680 case 24668:
12681 case 25307:
12682 case 26006:
12683 case 27209:
12684 case 29317:
12685 case 29487:
12686 case 29626:
12687 case 29640:
12688 case 29927:
12689 case 30055:
12690 case 30505:
12691 case 30686:
12692 case 31618:
12693 case 31627:
12694 case 32666:
12695 case 32860:
12696 case 33335:
12697 case 34344:
12698 case 36714:
12699 case 36868:
12700 case 36972:
12701 case 36986:
12702 case 36987:
12703 case 38378:
12704 case 38386:
12705 case 38628:
12706 case 38825:
12707 case 38892:
12708 case 39025:
12709 case 39026:
12710 case 39297:
12711 case 39309:
12712 case 40185:
12713 case 41069:
12714 case 41280:
12715 case 41957:
12716 case 43330:
12717 case 43649:
12718 case 43667:
12719 case 45055:
12720 case 45679:
12721 case 45680:
12722 case 47076:
12723 case 47248:
12724 case 47808:
12725 case 47809:
12726 case 49084:
12727 case 50455:
12728 case 51363:
12729 case 51432:
12730 case 51608:
12731 case 52257:
12732 case 52534:
12733 case 53086:
12734 case 53333:
12735 case 54113:
12736 case 55984:
12737 case 56405:
12738 case 57374:
12739 case 57464:
12740 case 57644:
12741 case 57725:
12742 case 58827:
12743 case 59016:
12744 case 59246:
12745 case 59254:
12746 case 59351:
12747 case 59357:
12748 case 59389:
12749 case 59575:
12750 case 60015:
12751 case 61558:
12752 case 61562:
12753 case 65821:
12754 case 68151:
12755 case 68152:
12756 case 68153:
12757 case 69028:
12758 case 69068:
12759 case 69211:
12760 case 69212:
12761 case 69387:
12762 case 69577:
12763 case 69972:
12764 case 70043:
12765 case 70080:
12766 case 70182:
12767 case 70208:
12768 case 70270:
12769 case 70386:
12770 case 70387:
12771 case 71143:
12772 case 71254:
12773 case 71296:
12774 case 71297:
12775 case 71936:
12776 case 72008:
12777 case 72503:
12778 case 72504:
12779 case 72901:
12780 case 72960:
12781 case 72961:
12782 case 75330:
12783 case 75331:
12784 case 75384:
12785 break;
12786 default:
12787 continue;
12788 }
12789 } break;
12790
12791 // warlock - Seed of Corruption
12792 case 27285:
12793 {
12794 bool can_proc_now = false;
12795 //if we proced on spell tick
12796 if (flag & PROC_ON_DONE_PERIODIC)
12797 {
12798 if (!CastingSpell)
12799 continue;
12800
12801 switch (CastingSpell->getId())
12802 {
12803 //SPELL_HASH_SEED_OF_CORRUPTION
12804 case 27243:
12805 case 27285:
12806 case 32863:
12807 case 32865:
12808 case 36123:
12809 case 37826:
12810 case 38252:
12811 case 39367:
12812 case 43991:
12813 case 44141:
12814 case 47831:
12815 case 47832:
12816 case 47833:
12817 case 47834:
12818 case 47835:
12819 case 47836:
12820 case 70388:
12821 break;
12822 default:
12823 continue;
12824 }
12825
12826 //this spell builds up n time
12827 if (ospinfo && damageInfo.realDamage < this->getHealth()) //if this is not a killer blow
12828 can_proc_now = true;
12829 }
12830 else can_proc_now = true; //target died
12831 if (can_proc_now == false)
12832 continue;
12833 Unit* new_caster = victim;
12834 if (new_caster && new_caster->isAlive())
12835 {
12836 const auto spellInfo = sSpellMgr.getSpellInfo(spellId); //we already modified this spell on server loading so it must exist
12837 Spell* spell = sSpellMgr.newSpell(new_caster, spellInfo, true, NULL);
12838 SpellCastTargets targets;
12839 targets.setDestination(GetPosition());
12840 spell->prepare(&targets);
12841 }
12842 spell_proc->deleteProc();
12843 continue;
12844 }
12845 break;
12846 // warlock - Improved Drain Soul
12847 case 18371:
12848 {
12849 if (!CastingSpell)
12850 continue;
12851
12852 //only trigger effect for specified spells
12853 switch (CastingSpell->getId())
12854 {
12855 //SPELL_HASH_DRAIN_SOUL
12856 case 1120:
12857 case 8288:
12858 case 8289:
12859 case 11675:
12860 case 18371:
12861 case 27217:
12862 case 32862:
12863 case 35839:
12864 case 47855:
12865 case 60452:
12866 break;
12867 default:
12868 continue;
12869 }
12870
12871 //null check was made before like 2 times already :P
12872 if (ospinfo)
12873 spell_proc->setOverrideEffectDamage(0, (ospinfo->calculateEffectValue(2)) * getMaxPower(POWER_TYPE_MANA) / 100);
12874 }
12875 break;
12876 // warlock - Unstable Affliction
12877 case 31117:
12878 {
12879 //null check was made before like 2 times already :P
12880 if (ospinfo)
12881 spell_proc->setOverrideEffectDamage(0, (ospinfo->calculateEffectValue(0)) * 9);
12882 }
12883 break;
12884
12885 //warlock - Nighfall
12886 case 17941:
12887 {
12888 if (CastingSpell == NULL)
12889 continue;//this should not occur unless we made a fuckup somewhere
12890
12891 //only trigger effect for specified spells
12892 switch (CastingSpell->getId())
12893 {
12894 //SPELL_HASH_CORRUPTION
12895 case 172:
12896 case 6222:
12897 case 6223:
12898 case 7648:
12899 case 11671:
12900 case 11672:
12901 case 13530:
12902 case 16402:
12903 case 16985:
12904 case 17510:
12905 case 18088:
12906 case 18376:
12907 case 18656:
12908 case 21068:
12909 case 23642:
12910 case 25311:
12911 case 27216:
12912 case 28829:
12913 case 30938:
12914 case 31405:
12915 case 32063:
12916 case 32197:
12917 case 37113:
12918 case 37961:
12919 case 39212:
12920 case 39621:
12921 case 41988:
12922 case 47782:
12923 case 47812:
12924 case 47813:
12925 case 56898:
12926 case 57645:
12927 case 58811:
12928 case 60016:
12929 case 61563:
12930 case 65810:
12931 case 68133:
12932 case 68134:
12933 case 68135:
12934 case 70602:
12935 case 70904:
12936 case 71937:
12937 //SPELL_HASH_DRAIN_LIFE
12938 case 689:
12939 case 699:
12940 case 709:
12941 case 7651:
12942 case 11699:
12943 case 11700:
12944 case 12693:
12945 case 16375:
12946 case 16414:
12947 case 16608:
12948 case 17173:
12949 case 17238:
12950 case 17620:
12951 case 18084:
12952 case 18557:
12953 case 18815:
12954 case 18817:
12955 case 20743:
12956 case 21170:
12957 case 24300:
12958 case 24435:
12959 case 24585:
12960 case 24618:
12961 case 26693:
12962 case 27219:
12963 case 27220:
12964 case 27994:
12965 case 29155:
12966 case 30412:
12967 case 34107:
12968 case 34696:
12969 case 35748:
12970 case 36224:
12971 case 36655:
12972 case 36825:
12973 case 37992:
12974 case 38817:
12975 case 39676:
12976 case 43417:
12977 case 44294:
12978 case 46155:
12979 case 46291:
12980 case 46466:
12981 case 47857:
12982 case 55646:
12983 case 64159:
12984 case 64160:
12985 case 69066:
12986 case 70213:
12987 case 71838:
12988 case 71839:
12989 break;
12990 default:
12991 continue;
12992 }
12993 }
12994 break;
12995 //warlock - Shadow Embrace
12996 case 32386:
12997 case 32388:
12998 case 32389:
12999 case 32390:
13000 case 32391:
13001 {
13002 if (CastingSpell == NULL)
13003 continue;
13004 else
13005 {
13006 switch (CastingSpell->getId())
13007 {
13008 case 184: //Corruption
13009 //SPELL_HASH_CURSE_OF_AGONY
13010 case 980:
13011 case 1014:
13012 case 6217:
13013 case 11711:
13014 case 11712:
13015 case 11713:
13016 case 14868:
13017 case 14875:
13018 case 17771:
13019 case 18266:
13020 case 18671:
13021 case 27218:
13022 case 29930:
13023 case 32418:
13024 case 37334:
13025 case 39672:
13026 case 46190:
13027 case 47863:
13028 case 47864:
13029 case 65814:
13030 case 68136:
13031 case 68137:
13032 case 68138:
13033 case 69404:
13034 case 70391:
13035 case 71112:
13036 //SPELL_HASH_SIPHON_LIFE
13037 case 35195:
13038 case 41597:
13039 case 63106:
13040 case 63108:
13041 //SPELL_HASH_SEED_OF_CORRUPTION
13042 case 27243:
13043 case 27285:
13044 case 32863:
13045 case 32865:
13046 case 36123:
13047 case 37826:
13048 case 38252:
13049 case 39367:
13050 case 43991:
13051 case 44141:
13052 case 47831:
13053 case 47832:
13054 case 47833:
13055 case 47834:
13056 case 47835:
13057 case 47836:
13058 case 70388:
13059 break;
13060 default:
13061 continue;
13062 }
13063 }
13064 }
13065 break;
13066#if VERSION_STRING <= WotLK
13067 //warlock - Aftermath
13068 case 18118:
13069 {
13070 if (CastingSpell == NULL)
13071 continue;//this should not occur unless we made a fuckup somewhere
13072
13073 //only trigger effect for specified spells
13074 auto _continue = false;
13075 const auto spellSkillRange = sSpellMgr.getSkillEntryRangeForSpell(CastingSpell->getId());
13076 for (const auto& [_, skill_line_ability] : spellSkillRange)
13077 {
13078 if (skill_line_ability->skilline != SKILL_DESTRUCTION)
13079 {
13080 _continue = true;
13081 break;
13082 }
13083 }
13084
13085 if (_continue)
13086 continue;
13087 }
13088 break;
13089#endif
13090 //warlock - Nether Protection
13091 case 30300:
13092 {
13093 if (CastingSpell == NULL)
13094 continue;//this should not occur unless we made a fuckup somewhere
13095
13096 //only trigger effect for specified spells
13097 if (!(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_DAMAGING))
13098 continue;
13099 if (!(CastingSpell->getSchoolMask() & SCHOOL_MASK_FIRE) &&
13100 !(CastingSpell->getSchoolMask() & SCHOOL_MASK_SHADOW))
13101 continue;
13102 }
13103 break;
13104 //warlock - Soul Leech - this whole spell should get rewritten. Uses bad formulas, bad trigger method, spell is rewritten ...
13105 case 30294:
13106 {
13107 if (CastingSpell == NULL)
13108 continue;//this should not occur unless we made a fuckup somewhere
13109 //only trigger effect for specified spells
13110 uint32_t amount;
13111
13112 switch (CastingSpell->getId())
13113 {
13114 // SPELL_HASH_SHADOW_BOLT: //Shadow Bolt
13115 case 686:
13116 case 695:
13117 case 705:
13118 case 1088:
13119 case 1106:
13120 case 7617:
13121 case 7619:
13122 case 7641:
13123 case 9613:
13124 case 11659:
13125 case 11660:
13126 case 11661:
13127 case 12471:
13128 case 12739:
13129 case 13440:
13130 case 13480:
13131 case 14106:
13132 case 14122:
13133 case 15232:
13134 case 15472:
13135 case 15537:
13136 case 16408:
13137 case 16409:
13138 case 16410:
13139 case 16783:
13140 case 16784:
13141 case 17393:
13142 case 17434:
13143 case 17435:
13144 case 17483:
13145 case 17509:
13146 case 18111:
13147 case 18138:
13148 case 18164:
13149 case 18205:
13150 case 18211:
13151 case 18214:
13152 case 18217:
13153 case 19728:
13154 case 19729:
13155 case 20298:
13156 case 20791:
13157 case 20807:
13158 case 20816:
13159 case 20825:
13160 case 21077:
13161 case 21141:
13162 case 22336:
13163 case 22677:
13164 case 24668:
13165 case 25307:
13166 case 26006:
13167 case 27209:
13168 case 29317:
13169 case 29487:
13170 case 29626:
13171 case 29640:
13172 case 29927:
13173 case 30055:
13174 case 30505:
13175 case 30686:
13176 case 31618:
13177 case 31627:
13178 case 32666:
13179 case 32860:
13180 case 33335:
13181 case 34344:
13182 case 36714:
13183 case 36868:
13184 case 36972:
13185 case 36986:
13186 case 36987:
13187 case 38378:
13188 case 38386:
13189 case 38628:
13190 case 38825:
13191 case 38892:
13192 case 39025:
13193 case 39026:
13194 case 39297:
13195 case 39309:
13196 case 40185:
13197 case 41069:
13198 case 41280:
13199 case 41957:
13200 case 43330:
13201 case 43649:
13202 case 43667:
13203 case 45055:
13204 case 45679:
13205 case 45680:
13206 case 47076:
13207 case 47248:
13208 case 47808:
13209 case 47809:
13210 case 49084:
13211 case 50455:
13212 case 51363:
13213 case 51432:
13214 case 51608:
13215 case 52257:
13216 case 52534:
13217 case 53086:
13218 case 53333:
13219 case 54113:
13220 case 55984:
13221 case 56405:
13222 case 57374:
13223 case 57464:
13224 case 57644:
13225 case 57725:
13226 case 58827:
13227 case 59016:
13228 case 59246:
13229 case 59254:
13230 case 59351:
13231 case 59357:
13232 case 59389:
13233 case 59575:
13234 case 60015:
13235 case 61558:
13236 case 61562:
13237 case 65821:
13238 case 68151:
13239 case 68152:
13240 case 68153:
13241 case 69028:
13242 case 69068:
13243 case 69211:
13244 case 69212:
13245 case 69387:
13246 case 69577:
13247 case 69972:
13248 case 70043:
13249 case 70080:
13250 case 70182:
13251 case 70208:
13252 case 70270:
13253 case 70386:
13254 case 70387:
13255 case 71143:
13256 case 71254:
13257 case 71296:
13258 case 71297:
13259 case 71936:
13260 case 72008:
13261 case 72503:
13262 case 72504:
13263 case 72901:
13264 case 72960:
13265 case 72961:
13266 case 75330:
13267 case 75331:
13268 case 75384:
13269 // SPELL_HASH_SOUL_FIRE: //Soul Fire
13270 case 6353:
13271 case 17924:
13272 case 27211:
13273 case 30545:
13274 case 47824:
13275 case 47825:
13276 // SPELL_HASH_INCINERATE: //Incinerate
13277 case 19397:
13278 case 23308:
13279 case 23309:
13280 case 29722:
13281 case 32231:
13282 case 32707:
13283 case 36832:
13284 case 38401:
13285 case 38918:
13286 case 39083:
13287 case 40239:
13288 case 41960:
13289 case 43971:
13290 case 44519:
13291 case 46043:
13292 case 47837:
13293 case 47838:
13294 case 53493:
13295 case 69973:
13296 case 71135:
13297 // SPELL_HASH_SEARING_PAIN: //Searing Pain
13298 case 5676:
13299 case 17919:
13300 case 17920:
13301 case 17921:
13302 case 17922:
13303 case 17923:
13304 case 27210:
13305 case 29492:
13306 case 30358:
13307 case 30459:
13308 case 47814:
13309 case 47815:
13310 case 65819:
13311 case 68148:
13312 case 68149:
13313 case 68150:
13314 // SPELL_HASH_CONFLAGRATE: //Conflagrate
13315 case 17962:
13316 // SPELL_HASH_CHAOS_BOLT: //Chaos Bolt
13317 case 50796:
13318 case 51287:
13319 case 59170:
13320 case 59171:
13321 case 59172:
13322 case 69576:
13323 case 71108:
13324 {
13325 amount = CastingSpell->calculateEffectValue(0);
13326 } break;
13327
13328 //SPELL_HASH_SHADOWBURN
13329 case 17877:
13330 case 18867:
13331 case 18868:
13332 case 18869:
13333 case 18870:
13334 case 18871:
13335 case 27263:
13336 case 29341:
13337 case 30546:
13338 case 47826:
13339 case 47827:
13340 {
13341 amount = CastingSpell->calculateEffectValue(1);
13342 } break;
13343 default:
13344 amount = 0;
13345
13346 }
13347
13348 if (!amount)
13349 continue;
13350
13351 const auto spellInfo = sSpellMgr.getSpellInfo(spellId);
13352 Spell* spell = sSpellMgr.newSpell(this, spellInfo, true, NULL);
13353 spell->setUnitTarget(this);
13354 if (ospinfo)
13355 doSpellHealing(this, spellId, amount * (ospinfo->calculateEffectValue(0)) / 100.0f, true);
13356 delete spell;
13357 spell = NULL;
13358 continue;
13359 }
13360 break;
13361 //warlock - pyroclasm
13362 case 18093:
13363 {
13364 if (CastingSpell == NULL)
13365 continue;//this should not occur unless we made a fuckup somewhere
13366
13367 switch (CastingSpell->getId())
13368 {
13369 //SPELL_HASH_RAIN_OF_FIRE
13370 case 4629:
13371 case 5740:
13372 case 6219:
13373 case 11677:
13374 case 11678:
13375 case 11990:
13376 case 16005:
13377 case 19474:
13378 case 19717:
13379 case 20754:
13380 case 24669:
13381 case 27212:
13382 case 28794:
13383 case 31340:
13384 case 31598:
13385 case 33508:
13386 case 33617:
13387 case 33627:
13388 case 33972:
13389 case 34169:
13390 case 34185:
13391 case 34360:
13392 case 34435:
13393 case 36808:
13394 case 37279:
13395 case 37465:
13396 case 38635:
13397 case 38741:
13398 case 39024:
13399 case 39273:
13400 case 39363:
13401 case 39376:
13402 case 42023:
13403 case 42218:
13404 case 42223:
13405 case 42224:
13406 case 42225:
13407 case 42226:
13408 case 42227:
13409 case 43440:
13410 case 47817:
13411 case 47818:
13412 case 47819:
13413 case 47820:
13414 case 49518:
13415 case 54099:
13416 case 54210:
13417 case 57757:
13418 case 58936:
13419 case 59971:
13420 case 69670:
13421 //SPELL_HASH_HELLFIRE_EFFECT
13422 case 5857:
13423 case 11681:
13424 case 11682:
13425 case 27214:
13426 case 30860:
13427 case 47822:
13428 case 65817:
13429 case 68142:
13430 case 68143:
13431 case 68144:
13432 case 69585:
13433 case 70284:
13434 //SPELL_HASH_SOUL_FIRE
13435 case 6353:
13436 case 17924:
13437 case 27211:
13438 case 30545:
13439 case 47824:
13440 case 47825:
13441 break;
13442 default:
13443 continue;
13444 }
13445 }
13446 break;
13447 case 54274:
13448 case 54276:
13449 case 54277:
13450 {
13451 if (CastingSpell == NULL)
13452 continue;
13453
13454 if (CastingSpell->getId() != 17962)
13455 continue;
13456 }
13457 break;
13458 //Mage - Missile Barrage
13459 case 44401:
13460 {
13461 if (CastingSpell == NULL)
13462 continue;
13463
13464 switch (CastingSpell->getId())
13465 {
13466 //SPELL_HASH_ARCANE_BLAST
13467 case 10833:
13468 case 16067:
13469 case 18091:
13470 case 20883:
13471 case 22893:
13472 case 22920:
13473 case 22940:
13474 case 24857:
13475 case 30451:
13476 case 30661:
13477 case 31457:
13478 case 32935:
13479 case 34793:
13480 case 35314:
13481 case 35927:
13482 case 36032:
13483 case 37126:
13484 case 38342:
13485 case 38344:
13486 case 38538:
13487 case 38881:
13488 case 40837:
13489 case 40881:
13490 case 42894:
13491 case 42896:
13492 case 42897:
13493 case 49198:
13494 case 50545:
13495 case 51797:
13496 case 51830:
13497 case 56969:
13498 case 58462:
13499 case 59257:
13500 case 59909:
13501 case 65791:
13502 case 67997:
13503 case 67998:
13504 case 67999:
13505 //SPELL_HASH_ARCANE_BARRAGE
13506 case 44425:
13507 case 44780:
13508 case 44781:
13509 case 50273:
13510 case 50804:
13511 case 56397:
13512 case 58456:
13513 case 59248:
13514 case 59381:
13515 case 63934:
13516 case 64599:
13517 case 64607:
13518 case 65799:
13519 case 67994:
13520 case 67995:
13521 case 67996:
13522 //SPELL_HASH_FIREBALL
13523 case 133:
13524 case 143:
13525 case 145:
13526 case 3140:
13527 case 8400:
13528 case 8401:
13529 case 8402:
13530 case 9053:
13531 case 9487:
13532 case 9488:
13533 case 10148:
13534 case 10149:
13535 case 10150:
13536 case 10151:
13537 case 10578:
13538 case 11839:
13539 case 11921:
13540 case 11985:
13541 case 12466:
13542 case 13140:
13543 case 13375:
13544 case 13438:
13545 case 14034:
13546 case 15228:
13547 case 15242:
13548 case 15536:
13549 case 15662:
13550 case 15665:
13551 case 16101:
13552 case 16412:
13553 case 16413:
13554 case 16415:
13555 case 16788:
13556 case 17290:
13557 case 18082:
13558 case 18105:
13559 case 18108:
13560 case 18199:
13561 case 18392:
13562 case 18796:
13563 case 19391:
13564 case 19816:
13565 case 20420:
13566 case 20678:
13567 case 20692:
13568 case 20714:
13569 case 20793:
13570 case 20797:
13571 case 20808:
13572 case 20811:
13573 case 20815:
13574 case 20823:
13575 case 21072:
13576 case 21159:
13577 case 21162:
13578 case 21402:
13579 case 21549:
13580 case 22088:
13581 case 23024:
13582 case 23411:
13583 case 24374:
13584 case 24611:
13585 case 25306:
13586 case 27070:
13587 case 29456:
13588 case 29925:
13589 case 29953:
13590 case 30218:
13591 case 30534:
13592 case 30691:
13593 case 30943:
13594 case 30967:
13595 case 31262:
13596 case 31620:
13597 case 32363:
13598 case 32369:
13599 case 32414:
13600 case 32491:
13601 case 33417:
13602 case 33793:
13603 case 33794:
13604 case 34083:
13605 case 34348:
13606 case 34653:
13607 case 36711:
13608 case 36805:
13609 case 36920:
13610 case 36971:
13611 case 37111:
13612 case 37329:
13613 case 37463:
13614 case 38641:
13615 case 38692:
13616 case 38824:
13617 case 39267:
13618 case 40554:
13619 case 40598:
13620 case 40877:
13621 case 41383:
13622 case 41484:
13623 case 42802:
13624 case 42832:
13625 case 42833:
13626 case 42834:
13627 case 42853:
13628 case 44189:
13629 case 44202:
13630 case 44237:
13631 case 45580:
13632 case 45595:
13633 case 45748:
13634 case 46164:
13635 case 46988:
13636 case 47074:
13637 case 49512:
13638 case 52282:
13639 case 54094:
13640 case 54095:
13641 case 54096:
13642 case 57628:
13643 case 59994:
13644 case 61567:
13645 case 61909:
13646 case 62796:
13647 case 63789:
13648 case 63815:
13649 case 66042:
13650 case 68310:
13651 case 68926:
13652 case 69570:
13653 case 69583:
13654 case 69668:
13655 case 70282:
13656 case 70409:
13657 case 70754:
13658 case 71153:
13659 case 71500:
13660 case 71501:
13661 case 71504:
13662 case 71748:
13663 case 71928:
13664 case 72023:
13665 case 72024:
13666 case 72163:
13667 case 72164:
13668 //SPELL_HASH_FROSTBOLT
13669 case 116:
13670 case 205:
13671 case 837:
13672 case 7322:
13673 case 8406:
13674 case 8407:
13675 case 8408:
13676 case 9672:
13677 case 10179:
13678 case 10180:
13679 case 10181:
13680 case 11538:
13681 case 12675:
13682 case 12737:
13683 case 13322:
13684 case 13439:
13685 case 15043:
13686 case 15497:
13687 case 15530:
13688 case 16249:
13689 case 16799:
13690 case 17503:
13691 case 20297:
13692 case 20792:
13693 case 20806:
13694 case 20819:
13695 case 20822:
13696 case 21369:
13697 case 23102:
13698 case 23412:
13699 case 24942:
13700 case 25304:
13701 case 27071:
13702 case 27072:
13703 case 28478:
13704 case 28479:
13705 case 29457:
13706 case 29926:
13707 case 29954:
13708 case 30942:
13709 case 31296:
13710 case 31622:
13711 case 32364:
13712 case 32370:
13713 case 32984:
13714 case 34347:
13715 case 35316:
13716 case 36279:
13717 case 36710:
13718 case 36990:
13719 case 37930:
13720 case 38238:
13721 case 38534:
13722 case 38645:
13723 case 38697:
13724 case 38826:
13725 case 39064:
13726 case 40429:
13727 case 40430:
13728 case 41384:
13729 case 41486:
13730 case 42719:
13731 case 42803:
13732 case 42841:
13733 case 42842:
13734 case 43083:
13735 case 43428:
13736 case 44606:
13737 case 44843:
13738 case 46035:
13739 case 46987:
13740 case 49037:
13741 case 50378:
13742 case 50721:
13743 case 54791:
13744 case 55802:
13745 case 55807:
13746 case 56775:
13747 case 56837:
13748 case 57665:
13749 case 57825:
13750 case 58457:
13751 case 58535:
13752 case 59017:
13753 case 59251:
13754 case 59280:
13755 case 59638:
13756 case 59855:
13757 case 61087:
13758 case 61461:
13759 case 61590:
13760 case 61730:
13761 case 61747:
13762 case 62583:
13763 case 62601:
13764 case 63913:
13765 case 65807:
13766 case 68003:
13767 case 68004:
13768 case 68005:
13769 case 69274:
13770 case 69573:
13771 case 70277:
13772 case 70327:
13773 case 71318:
13774 case 71420:
13775 case 72007:
13776 case 72166:
13777 case 72167:
13778 case 72501:
13779 case 72502:
13780 //SPELL_HASH_FROSTFIRE_BOLT
13781 case 44614:
13782 case 47610:
13783 case 51779:
13784 case 69869:
13785 case 69984:
13786 case 70616:
13787 case 71130:
13788 break;
13789 default:
13790 continue;
13791 }
13792 }
13793 break;
13794 //mage - Improved Scorch
13795 case 22959:
13796 {
13797 if (CastingSpell == NULL)
13798 continue;//this should not occur unless we made a fuckup somewhere
13799
13800 //only trigger effect for specified spells
13801 switch (CastingSpell->getId())
13802 {
13803 //SPELL_HASH_SCORCH
13804 case 1811:
13805 case 2948:
13806 case 8444:
13807 case 8445:
13808 case 8446:
13809 case 8447:
13810 case 8448:
13811 case 8449:
13812 case 10205:
13813 case 10206:
13814 case 10207:
13815 case 10208:
13816 case 10209:
13817 case 10210:
13818 case 13878:
13819 case 15241:
13820 case 17195:
13821 case 27073:
13822 case 27074:
13823 case 27375:
13824 case 27376:
13825 case 35377:
13826 case 36807:
13827 case 38391:
13828 case 38636:
13829 case 42858:
13830 case 42859:
13831 case 47723:
13832 case 50183:
13833 case 56938:
13834 case 62546:
13835 case 62548:
13836 case 62549:
13837 case 62551:
13838 case 62553:
13839 case 63473:
13840 case 63474:
13841 case 63475:
13842 case 63476:
13843 case 75412:
13844 case 75419:
13845 break;
13846 default:
13847 continue;
13848 }
13849 }
13850 break;
13851 //mage - Combustion
13852 case 28682:
13853 {
13854 if (CastingSpell == NULL)
13855 continue;//this should not occur unless we made a fuckup somewhere
13856 //only trigger effect for specified spells
13857 if (!(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_DAMAGING) || !(CastingSpell->getSchoolMask() & SCHOOL_MASK_FIRE))
13858 continue;
13859 if (damageInfo.isCritical && spell_proc->getCreatedByAura() != nullptr)
13860 {
13861 auto procAura = spell_proc->getCreatedByAura();
13862 procAura->setCharges(procAura->getCharges() + 1);
13863 if (procAura->getCharges() >= 3) //whatch that number cause it depends on original stack count !
13864 {
13865 uint32_t combastion[] =
13866 {
13867 //SPELL_HASH_COMBUSTION
13868 11129,
13869 28682,
13870 29977,
13871 74630,
13872 75882,
13873 75883,
13874 75884,
13875 0
13876 };
13877
13878 removeAllAurasById(combastion);
13879 continue;
13880 }
13881 }
13882 }
13883 break;
13884 //mage - Winter's Chill
13885 case 12579:
13886 // Winter's Chill shouldn't proc on self
13887 if (victim == this || !(CastingSpell->getSchoolMask() & SCHOOL_MASK_FROST))
13888 continue;
13889 break;
13890 //item - Thunderfury
13891 case 21992:
13892 if (victim == this)
13893 continue;
13894 break;
13895 //warrior - Intimidating Shout
13896 case 5246:
13897 if (victim == this)
13898 continue;
13899 break;
13900
13901 //priest - Borrowed time
13902 case 59887:
13903 case 59888:
13904 case 59889:
13905 case 59890:
13906 case 59891:
13907 {
13908 if (CastingSpell == NULL)
13909 continue;
13910
13911 switch (CastingSpell->getId())
13912 {
13913 //SPELL_HASH_POWER_WORD__SHIELD
13914 case 17:
13915 case 592:
13916 case 600:
13917 case 3747:
13918 case 6065:
13919 case 6066:
13920 case 10898:
13921 case 10899:
13922 case 10900:
13923 case 10901:
13924 case 11647:
13925 case 11835:
13926 case 11974:
13927 case 17139:
13928 case 20697:
13929 case 22187:
13930 case 25217:
13931 case 25218:
13932 case 27607:
13933 case 29408:
13934 case 32595:
13935 case 35944:
13936 case 36052:
13937 case 41373:
13938 case 44175:
13939 case 44291:
13940 case 46193:
13941 case 48065:
13942 case 48066:
13943 case 66099:
13944 case 68032:
13945 case 68033:
13946 case 68034:
13947 case 71548:
13948 case 71780:
13949 case 71781:
13950 break;
13951 default:
13952 continue;
13953 }
13954 }
13955 break;
13956
13957 //priest - Inspiration
13958 case 15363:
13959 case 14893:
13960 case 15357:
13961 case 15359:
13962 {
13963 if (!CastingSpell || !(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_HEALING))
13964 continue;
13965 }
13966 break;
13967 //priest - Blessed Recovery
13968 case 27813:
13969 case 27817:
13970 case 27818:
13971 {
13972 if (!isPlayer() || !damageInfo.realDamage)
13973 continue;
13974 SpellInfo const* parentproc = sSpellMgr.getSpellInfo(origId);
13975 const auto spellInfo = sSpellMgr.getSpellInfo(spellId);
13976 if (!parentproc || !spellInfo)
13977 continue;
13978 int32_t val = parentproc->calculateEffectValue(0);
13979 Spell* spell = sSpellMgr.newSpell(this, spellInfo, true, NULL);
13980 spell->forced_basepoints->set(0, (val * damageInfo.realDamage) / 300); //per tick
13981 SpellCastTargets targets(getGuid());
13982 spell->prepare(&targets);
13983 continue;
13984 }
13985 break;
13986
13987
13988 //Shaman - Healing Way
13989 case 29203:
13990 {
13991 if (CastingSpell == NULL)
13992 continue;//this should not occur unless we made a fuckup somewhere
13993
13994 //only trigger effect for specified spells
13995 switch (CastingSpell->getId())
13996 {
13997 //SPELL_HASH_HEALING_WAVE
13998 case 331:
13999 case 332:
14000 case 547:
14001 case 913:
14002 case 939:
14003 case 959:
14004 case 8005:
14005 case 10395:
14006 case 10396:
14007 case 11986:
14008 case 12491:
14009 case 12492:
14010 case 15982:
14011 case 25357:
14012 case 25391:
14013 case 25396:
14014 case 26097:
14015 case 38330:
14016 case 43548:
14017 case 48700:
14018 case 49272:
14019 case 49273:
14020 case 51586:
14021 case 52868:
14022 case 55597:
14023 case 57785:
14024 case 58980:
14025 case 59083:
14026 case 60012:
14027 case 61569:
14028 case 67528:
14029 case 68318:
14030 case 69958:
14031 case 71133:
14032 case 75382:
14033 break;
14034 default:
14035 continue;
14036 }
14037 }
14038 break;
14039 //Shaman - Elemental Devastation
14040 case 29177:
14041 case 29178:
14042 case 30165:
14043 {
14044 if (CastingSpell == NULL)
14045 continue;//this should not occur unless we made a fuckup somewhere
14046 //only trigger effect for specified spells
14047 if (!(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_DAMAGING)) //healing wave
14048 continue;
14049 }
14050 break;
14051 //Shaman - Ancestral Fortitude
14052 case 16177:
14053 case 16236:
14054 case 16237:
14055 {
14056 if (CastingSpell == NULL)
14057 continue;
14058
14059 //Do not proc on Earth Shield crits
14060 switch (CastingSpell->getId())
14061 {
14062 //SPELL_HASH_EARTH_SHIELD
14063 case 379:
14064 case 974:
14065 case 32593:
14066 case 32594:
14067 case 32734:
14068 case 38590:
14069 case 49283:
14070 case 49284:
14071 case 54479:
14072 case 54480:
14073 case 55599:
14074 case 55600:
14075 case 56451:
14076 case 57802:
14077 case 57803:
14078 case 58981:
14079 case 58982:
14080 case 59471:
14081 case 59472:
14082 case 60013:
14083 case 60014:
14084 case 66063:
14085 case 66064:
14086 case 67530:
14087 case 67537:
14088 case 68320:
14089 case 68592:
14090 case 68593:
14091 case 68594:
14092 case 69568:
14093 case 69569:
14094 case 69925:
14095 case 69926:
14096 continue;
14097 default:
14098 break;
14099 }
14100 }
14101 //Shaman - Earthliving Weapon
14102 case 51940:
14103 case 51989:
14104 case 52004:
14105 case 52005:
14106 case 52007:
14107 case 52008:
14108 {
14109 if (CastingSpell == NULL)
14110 continue;
14111
14112 if (!(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_HEALING)) //healing spell
14113 continue;
14114 }
14115 break;
14116 //Shaman - Tidal Waves
14117 case 51562:
14118 case 51563:
14119 case 51564:
14120 case 51565:
14121 case 51566:
14122 {
14123 if (CastingSpell == NULL)
14124 continue;
14125
14126 switch (CastingSpell->getId())
14127 {
14128 //SPELL_HASH_CHAIN_HEAL
14129 case 1064:
14130 case 10622:
14131 case 10623:
14132 case 14900:
14133 case 15799:
14134 case 16367:
14135 case 25422:
14136 case 25423:
14137 case 33642:
14138 case 41114:
14139 case 42027:
14140 case 42477:
14141 case 43527:
14142 case 48894:
14143 case 54481:
14144 case 55458:
14145 case 55459:
14146 case 59473:
14147 case 69923:
14148 case 70425:
14149 case 71120:
14150 case 75370:
14151 //SPELL_HASH_RIPTIDE
14152 case 22419:
14153 case 61295:
14154 case 61299:
14155 case 61300:
14156 case 61301:
14157 case 66053:
14158 case 68118:
14159 case 68119:
14160 case 68120:
14161 case 75367:
14162 break;
14163 default:
14164 continue;
14165 }
14166 }
14167 break;
14168 // Totem of the Third Wind
14169 case 42371:
14170 case 34132:
14171 case 46099:
14172 case 43729:
14173 {
14174 if (CastingSpell == NULL)
14175 continue;
14176
14177 switch (CastingSpell->getId())
14178 {
14179 //SPELL_HASH_LESSER_HEALING_WAVE
14180 case 8004:
14181 case 8008:
14182 case 8010:
14183 case 10466:
14184 case 10467:
14185 case 10468:
14186 case 25420:
14187 case 27624:
14188 case 28849:
14189 case 28850:
14190 case 44256:
14191 case 46181:
14192 case 49275:
14193 case 49276:
14194 case 49309:
14195 case 66055:
14196 case 68115:
14197 case 68116:
14198 case 68117:
14199 case 75366:
14200 break;
14201 default:
14202 continue;
14203 }
14204 }
14205 break;
14206 //Stonebreaker's Totem
14207 case 43749:
14208 {
14209 if (CastingSpell == NULL)
14210 continue;
14211
14212 switch (CastingSpell->getId())
14213 {
14214 //SPELL_HASH_EARTH_SHOCK
14215 case 8042:
14216 case 8044:
14217 case 8045:
14218 case 8046:
14219 case 10412:
14220 case 10413:
14221 case 10414:
14222 case 13281:
14223 case 13728:
14224 case 15501:
14225 case 22885:
14226 case 23114:
14227 case 24685:
14228 case 25025:
14229 case 25454:
14230 case 26194:
14231 case 43305:
14232 case 47071:
14233 case 49230:
14234 case 49231:
14235 case 54511:
14236 case 56506:
14237 case 57783:
14238 case 60011:
14239 case 61668:
14240 case 65973:
14241 case 68100:
14242 case 68101:
14243 case 68102:
14244 //SPELL_HASH_FLAME_SHOCK
14245 case 8050:
14246 case 8052:
14247 case 8053:
14248 case 10447:
14249 case 10448:
14250 case 13729:
14251 case 15039:
14252 case 15096:
14253 case 15616:
14254 case 16804:
14255 case 22423:
14256 case 23038:
14257 case 25457:
14258 case 29228:
14259 case 32967:
14260 case 34354:
14261 case 39529:
14262 case 39590:
14263 case 41115:
14264 case 43303:
14265 case 49232:
14266 case 49233:
14267 case 51588:
14268 case 55613:
14269 case 58940:
14270 case 58971:
14271 case 59684:
14272 //SPELL_HASH_FROST_SHOCK
14273 case 8056:
14274 case 8058:
14275 case 10472:
14276 case 10473:
14277 case 12548:
14278 case 15089:
14279 case 15499:
14280 case 19133:
14281 case 21030:
14282 case 21401:
14283 case 22582:
14284 case 23115:
14285 case 25464:
14286 case 29666:
14287 case 34353:
14288 case 37332:
14289 case 37865:
14290 case 38234:
14291 case 39062:
14292 case 41116:
14293 case 43524:
14294 case 46180:
14295 case 49235:
14296 case 49236:
14297 break;
14298 default:
14299 continue;
14300 }
14301 }
14302 break;
14303 // Librams of Justice
14304 case 34135:
14305 case 42369:
14306 case 43727:
14307 case 46093:
14308 {
14309 if (CastingSpell == NULL)
14310 continue;
14311
14312 switch (CastingSpell->getId())
14313 {
14314 //SPELL_HASH_FLASH_OF_LIGHT
14315 case 19750:
14316 case 19939:
14317 case 19940:
14318 case 19941:
14319 case 19942:
14320 case 19943:
14321 case 25514:
14322 case 27137:
14323 case 33641:
14324 case 37249:
14325 case 37254:
14326 case 37257:
14327 case 48784:
14328 case 48785:
14329 case 57766:
14330 case 59997:
14331 case 66113:
14332 case 66922:
14333 case 68008:
14334 case 68009:
14335 case 68010:
14336 case 71930:
14337 break;
14338 default:
14339 continue;
14340 }
14341 }
14342 break;
14343 //Libram of Divine Judgement
14344 case 43747:
14345 {
14346 if (CastingSpell == NULL)
14347 continue;
14348
14349 switch (CastingSpell->getId())
14350 {
14351 //SPELL_HASH_JUDGEMENT_OF_COMMAND
14352 case 20425:
14353 case 20467:
14354 case 29386:
14355 case 32778:
14356 case 33554:
14357 case 41368:
14358 case 41470:
14359 case 66005:
14360 case 68017:
14361 case 68018:
14362 case 68019:
14363 case 71551:
14364 //SPELL_HASH_JUDGEMENT
14365 case 10321:
14366 case 23590:
14367 case 23591:
14368 case 35170:
14369 case 41467:
14370 case 43838:
14371 case 54158:
14372 break;
14373 default:
14374 continue;
14375 }
14376 }
14377 break;
14378 case 16246:
14379 {
14380 switch (CastingSpell->getId())
14381 {
14382 // Lightning Overload Proc is already free
14383 case 39805:
14384 //SPELL_HASH_LIGHTNING_BOLT
14385 case 403:
14386 case 529:
14387 case 548:
14388 case 915:
14389 case 943:
14390 case 6041:
14391 case 8246:
14392 case 9532:
14393 case 10391:
14394 case 10392:
14395 case 12167:
14396 case 13482:
14397 case 13527:
14398 case 14109:
14399 case 14119:
14400 case 15207:
14401 case 15208:
14402 case 15234:
14403 case 15801:
14404 case 16782:
14405 case 18081:
14406 case 18089:
14407 case 19874:
14408 case 20295:
14409 case 20802:
14410 case 20805:
14411 case 20824:
14412 case 22414:
14413 case 23592:
14414 case 25448:
14415 case 25449:
14416 case 26098:
14417 case 31764:
14418 case 34345:
14419 case 35010:
14420 case 36152:
14421 case 37273:
14422 case 37661:
14423 case 37664:
14424 case 38465:
14425 case 39065:
14426 case 41184:
14427 case 42024:
14428 case 43526:
14429 case 43903:
14430 case 45075:
14431 case 45284:
14432 case 45286:
14433 case 45287:
14434 case 45288:
14435 case 45289:
14436 case 45290:
14437 case 45291:
14438 case 45292:
14439 case 45293:
14440 case 45294:
14441 case 45295:
14442 case 45296:
14443 case 48698:
14444 case 48895:
14445 case 49237:
14446 case 49238:
14447 case 49239:
14448 case 49240:
14449 case 49418:
14450 case 49454:
14451 case 51587:
14452 case 51618:
14453 case 53044:
14454 case 53314:
14455 case 54843:
14456 case 55044:
14457 case 56326:
14458 case 56891:
14459 case 57780:
14460 case 57781:
14461 case 59006:
14462 case 59024:
14463 case 59081:
14464 case 59169:
14465 case 59199:
14466 case 59683:
14467 case 59863:
14468 case 60009:
14469 case 60032:
14470 case 61374:
14471 case 61893:
14472 case 63809:
14473 case 64098:
14474 case 64696:
14475 case 65987:
14476 case 68112:
14477 case 68113:
14478 case 68114:
14479 case 69567:
14480 case 69970:
14481 case 71136:
14482 case 71934:
14483 //SPELL_HASH_CHAIN_LIGHTNING
14484 case 421:
14485 case 930:
14486 case 2860:
14487 case 10605:
14488 case 12058:
14489 case 15117:
14490 case 15305:
14491 case 15659:
14492 case 16006:
14493 case 16033:
14494 case 16921:
14495 case 20831:
14496 case 21179:
14497 case 22355:
14498 case 23106:
14499 case 23206:
14500 case 24680:
14501 case 25021:
14502 case 25439:
14503 case 25442:
14504 case 27567:
14505 case 28167:
14506 case 28293:
14507 case 28900:
14508 case 31330:
14509 case 31717:
14510 case 32337:
14511 case 33643:
14512 case 37448:
14513 case 39066:
14514 case 39945:
14515 case 40536:
14516 case 41183:
14517 case 42441:
14518 case 42804:
14519 case 43435:
14520 case 44318:
14521 case 45297:
14522 case 45298:
14523 case 45299:
14524 case 45300:
14525 case 45301:
14526 case 45302:
14527 case 45868:
14528 case 46380:
14529 case 48140:
14530 case 48699:
14531 case 49268:
14532 case 49269:
14533 case 49270:
14534 case 49271:
14535 case 50830:
14536 case 52383:
14537 case 54334:
14538 case 54531:
14539 case 59082:
14540 case 59220:
14541 case 59223:
14542 case 59273:
14543 case 59517:
14544 case 59716:
14545 case 59844:
14546 case 61528:
14547 case 61879:
14548 case 62131:
14549 case 63479:
14550 case 64213:
14551 case 64215:
14552 case 64390:
14553 case 64758:
14554 case 64759:
14555 case 67529:
14556 case 68319:
14557 case 69696:
14558 case 75362:
14559 //SPELL_HASH_EARTH_SHOCK
14560 case 8042:
14561 case 8044:
14562 case 8045:
14563 case 8046:
14564 case 10412:
14565 case 10413:
14566 case 10414:
14567 case 13281:
14568 case 13728:
14569 case 15501:
14570 case 22885:
14571 case 23114:
14572 case 24685:
14573 case 25025:
14574 case 25454:
14575 case 26194:
14576 case 43305:
14577 case 47071:
14578 case 49230:
14579 case 49231:
14580 case 54511:
14581 case 56506:
14582 case 57783:
14583 case 60011:
14584 case 61668:
14585 case 65973:
14586 case 68100:
14587 case 68101:
14588 case 68102:
14589 //SPELL_HASH_FLAME_SHOCK
14590 case 8050:
14591 case 8052:
14592 case 8053:
14593 case 10447:
14594 case 10448:
14595 case 13729:
14596 case 15039:
14597 case 15096:
14598 case 15616:
14599 case 16804:
14600 case 22423:
14601 case 23038:
14602 case 25457:
14603 case 29228:
14604 case 32967:
14605 case 34354:
14606 case 39529:
14607 case 39590:
14608 case 41115:
14609 case 43303:
14610 case 49232:
14611 case 49233:
14612 case 51588:
14613 case 55613:
14614 case 58940:
14615 case 58971:
14616 case 59684:
14617 //SPELL_HASH_FROST_SHOCK
14618 case 8056:
14619 case 8058:
14620 case 10472:
14621 case 10473:
14622 case 12548:
14623 case 15089:
14624 case 15499:
14625 case 19133:
14626 case 21030:
14627 case 21401:
14628 case 22582:
14629 case 23115:
14630 case 25464:
14631 case 29666:
14632 case 34353:
14633 case 37332:
14634 case 37865:
14635 case 38234:
14636 case 39062:
14637 case 41116:
14638 case 43524:
14639 case 46180:
14640 case 49235:
14641 case 49236:
14642 break;
14643 default:
14644 continue;
14645 }
14646 }
14647 break;
14648 //shaman - windfury weapon
14649 case 8232:
14650 case 8235:
14651 case 10486:
14652 case 16362:
14653 case 25505:
14654 {
14655 if (!isPlayer())
14656 continue;
14657 //!! The weird thing is that we need the spell that triggered this enchant spell in order to output logs ..we are using oldspell info too
14658 //we have to recalc the value of this spell
14659 const auto spellInfo = sSpellMgr.getSpellInfo(origId);
14660 uint32_t AP_owerride = spellInfo->calculateEffectValue(0);
14661 uint32_t dmg2 = static_cast<Player*>(this)->getMainMeleeDamage(AP_owerride);
14662 SpellInfo const* sp_for_the_logs = sSpellMgr.getSpellInfo(spellId);
14663 strike(victim, MELEE, sp_for_the_logs, dmg2, 0, 0, true, false);
14664 strike(victim, MELEE, sp_for_the_logs, dmg2, 0, 0, true, false);
14665 spellId = 33010; // WF animation
14666 }
14667 break;
14668 //rogue - Ruthlessness
14669 case 14157:
14670 {
14671 if (CastingSpell == NULL)
14672 continue;//this should not occur unless we made a fuckup somewhere
14673 //we need a finishing move for this
14674 if (!(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_FINISHING_MOVE) || victim == this)
14675 continue;
14676 }
14677 break;
14678 // rogue - T10 4P bonus
14679 case 70802:
14680 {
14681 // The rogue bonus set of T10 requires a finishing move
14682 if (!(CastingSpell && CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_FINISHING_MOVE))
14683 continue;
14684 }
14685 break;
14686 //warrior - improved berserker rage
14687 case 23690:
14688 case 23691:
14689 {
14690 if (!CastingSpell || CastingSpell->getId() != 18499)
14691 continue;
14692 }
14693 break;
14694 //mage - Arcane Concentration
14695 case 12536:
14696 {
14697 //requires damageing spell
14698 if (CastingSpell == NULL)
14699 continue;//this should not occur unless we made a fuckup somewhere
14700 if (!(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_DAMAGING))
14701 continue;
14702 }
14703 break;
14704 //mage - Improved Blizzard
14705 case 12484:
14706 case 12485:
14707 case 12486:
14708 {
14709 if (CastingSpell == NULL)
14710 continue;
14711
14712 if (victim == this)
14713 continue;
14714
14715 switch (CastingSpell->getId())
14716 {
14717 //SPELL_HASH_BLIZZARD
14718 case 10:
14719 case 1196:
14720 case 6141:
14721 case 6142:
14722 case 8364:
14723 case 8427:
14724 case 8428:
14725 case 10185:
14726 case 10186:
14727 case 10187:
14728 case 10188:
14729 case 10189:
14730 case 10190:
14731 case 15783:
14732 case 19099:
14733 case 20680:
14734 case 21096:
14735 case 21367:
14736 case 25019:
14737 case 26607:
14738 case 27085:
14739 case 27384:
14740 case 27618:
14741 case 29458:
14742 case 29951:
14743 case 30093:
14744 case 31266:
14745 case 31581:
14746 case 33418:
14747 case 33624:
14748 case 33634:
14749 case 34167:
14750 case 34183:
14751 case 34356:
14752 case 37263:
14753 case 37671:
14754 case 38646:
14755 case 39416:
14756 case 41382:
14757 case 41482:
14758 case 42198:
14759 case 42208:
14760 case 42209:
14761 case 42210:
14762 case 42211:
14763 case 42212:
14764 case 42213:
14765 case 42937:
14766 case 42938:
14767 case 42939:
14768 case 42940:
14769 case 44178:
14770 case 46195:
14771 case 47727:
14772 case 49034:
14773 case 50715:
14774 case 56936:
14775 case 58693:
14776 case 59278:
14777 case 59369:
14778 case 59854:
14779 case 61085:
14780 case 62576:
14781 case 62577:
14782 case 62602:
14783 case 62603:
14784 case 62706:
14785 case 64642:
14786 case 64653:
14787 case 70362:
14788 case 70421:
14789 case 71118:
14790 break;
14791 default:
14792 continue;
14793 }
14794 }
14795 break;
14796 //Hunter - The Beast Within
14797 case 34471:
14798 {
14799 if (CastingSpell == NULL)
14800 continue;
14801
14802 if (CastingSpell->getId() != 19574)
14803 continue;
14804 }
14805 //Hunter - Thrill of the Hunt
14806 case 34720:
14807 {
14808 if (CastingSpell == NULL)
14809 continue;
14810 spell_proc->setOverrideEffectDamage(0, CastingSpell->getManaCost() * 40 / 100);
14811 }
14812 break;
14813 //priest - Reflective Shield
14814 case 33619:
14815 {
14816 if (!damageInfo.absorbedDamage)
14817 continue;
14818
14819 //requires Power Word: Shield active
14820 uint32_t powerWordShield[] =
14821 {
14822 //SPELL_HASH_POWER_WORD__SHIELD
14823 17,
14824 592,
14825 600,
14826 3747,
14827 6065,
14828 6066,
14829 10898,
14830 10899,
14831 10900,
14832 10901,
14833 11647,
14834 11835,
14835 11974,
14836 17139,
14837 20697,
14838 22187,
14839 25217,
14840 25218,
14841 27607,
14842 29408,
14843 32595,
14844 35944,
14845 36052,
14846 41373,
14847 44175,
14848 44291,
14849 46193,
14850 48065,
14851 48066,
14852 66099,
14853 68032,
14854 68033,
14855 68034,
14856 71548,
14857 71780,
14858 71781,
14859 0
14860 };
14861
14862 int power_word_id = hasAurasWithId(powerWordShield);
14863 if (!power_word_id)
14864 power_word_id = 17;
14865 //make a direct strike then exit rest of handler
14866 if (ospinfo)
14867 {
14868 auto tdmg = damageInfo.absorbedDamage * (ospinfo->calculateEffectValue(0)) / 100.0f;
14869 //somehow we should make this not caused any threat (to be done)
14870 doSpellDamage(victim, power_word_id, tdmg, 0, true);
14871 }
14872 continue;
14873 }
14874 break;
14875 //rogue - combat potency
14876 case 35542:
14877 case 35545:
14878 case 35546:
14879 case 35547:
14880 case 35548:
14881 {
14882 if (!isPlayer() || !damageInfo.realDamage)
14883 continue;
14884 //this needs offhand weapon
14885 Item* it = static_cast<Player*>(this)->getItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_OFFHAND);
14886 if (it == nullptr || it->getItemProperties()->InventoryType != INVTYPE_WEAPON)
14887 continue;
14888 }
14889 break;
14890 //paladin - Improved Lay on Hands
14891 case 20233:
14892 case 20236:
14893 {
14894 if (CastingSpell == NULL)
14895 continue;
14896
14897 switch (CastingSpell->getId())
14898 {
14899 //SPELL_HASH_LAY_ON_HANDS
14900 case 633:
14901 case 2800:
14902 case 9257:
14903 case 10310:
14904 case 17233:
14905 case 20233:
14906 case 20236:
14907 case 27154:
14908 case 48788:
14909 case 53778:
14910 break;
14911 default:
14912 continue;
14913 }
14914 }
14915 break;
14916 //paladin - Infusion of Light
14917 case 53672:
14918 case 54149:
14919 {
14920 if (CastingSpell == NULL)
14921 continue;
14922
14923 switch (CastingSpell->getId())
14924 {
14925 //SPELL_HASH_HOLY_SHOCK
14926 case 20473:
14927 case 20929:
14928 case 20930:
14929 case 25902:
14930 case 25903:
14931 case 25911:
14932 case 25912:
14933 case 25913:
14934 case 25914:
14935 case 27174:
14936 case 27175:
14937 case 27176:
14938 case 32771:
14939 case 33072:
14940 case 33073:
14941 case 33074:
14942 case 35160:
14943 case 36340:
14944 case 38921:
14945 case 48820:
14946 case 48821:
14947 case 48822:
14948 case 48823:
14949 case 48824:
14950 case 48825:
14951 case 66114:
14952 case 68014:
14953 case 68015:
14954 case 68016:
14955 break;
14956 default:
14957 continue;
14958 }
14959 }
14960 break;
14961 //paladin - Sacred Cleansing
14962 case 53659:
14963 {
14964 if (CastingSpell == NULL)
14965 continue;
14966
14967 switch (CastingSpell->getId())
14968 {
14969 //SPELL_HASH_CLEANSE
14970 case 4987:
14971 case 28787:
14972 case 28788:
14973 case 29380:
14974 case 32400:
14975 case 39078:
14976 case 57767:
14977 case 66116:
14978 case 68621:
14979 case 68622:
14980 case 68623:
14981 break;
14982 default:
14983 continue;
14984 }
14985 }
14986 break;
14987 //paladin - Judgements of the Pure
14988 case 53655:
14989 case 53656:
14990 case 53657:
14991 case 54152:
14992 case 54153:
14993 {
14994 if (CastingSpell == NULL)
14995 continue;
14996 if (CastingSpell->getId() != 53408 && CastingSpell->getId() != 53407 && CastingSpell->getId() != 20271)
14997 continue;
14998 }
14999 break;
15000 case 21183: //Paladin - Heart of the Crusader
15001 case 54498:
15002 case 54499:
15003 {
15004 if (CastingSpell == NULL)
15005 continue;
15006 if (CastingSpell->getId() != 53408 && CastingSpell->getId() != 53407 && CastingSpell->getId() != 20271)
15007 continue;
15008 }
15009 break;
15010 case 54203: //Paladin - Sheath of Light
15011 {
15012 if (CastingSpell == NULL)
15013 continue;
15014
15015 switch (CastingSpell->getId())
15016 {
15017 //SPELL_HASH_FLASH_OF_LIGHT
15018 case 19750:
15019 case 19939:
15020 case 19940:
15021 case 19941:
15022 case 19942:
15023 case 19943:
15024 case 25514:
15025 case 27137:
15026 case 33641:
15027 case 37249:
15028 case 37254:
15029 case 37257:
15030 case 48784:
15031 case 48785:
15032 case 57766:
15033 case 59997:
15034 case 66113:
15035 case 66922:
15036 case 68008:
15037 case 68009:
15038 case 68010:
15039 case 71930:
15040 //SPELL_HASH_HOLY_LIGHT
15041 case 635:
15042 case 639:
15043 case 647:
15044 case 1026:
15045 case 1042:
15046 case 3472:
15047 case 10328:
15048 case 10329:
15049 case 13952:
15050 case 15493:
15051 case 25263:
15052 case 25292:
15053 case 27135:
15054 case 27136:
15055 case 29383:
15056 case 29427:
15057 case 29562:
15058 case 31713:
15059 case 32769:
15060 case 37979:
15061 case 43451:
15062 case 44479:
15063 case 46029:
15064 case 48781:
15065 case 48782:
15066 case 52444:
15067 case 56539:
15068 case 58053:
15069 case 66112:
15070 case 68011:
15071 case 68012:
15072 case 68013:
15073 break;
15074 default:
15075 continue;
15076 }
15077
15078 const auto spellInfo = sSpellMgr.getSpellInfo(54203);
15079 auto spell_duration = sSpellDurationStore.lookupEntry(spellInfo->getDurationIndex());
15080 uint32_t tickcount = GetDuration(spell_duration) / spellInfo->getEffectAmplitude(0);
15081 if (ospinfo)
15082 spell_proc->setOverrideEffectDamage(0, ospinfo->getEffectBasePoints(0) * damageInfo.realDamage / (100 * tickcount));
15083 }
15084 break;
15085
15086 //////////////////////////////////////////////////////////////////////////////////////////
15087 // WARRIOR
15088
15089 // Warrior - Improved Revenge
15090 case 12798:
15091 {
15092 switch (CastingSpell->getId())
15093 {
15094 //SPELL_HASH_REVENGE
15095 case 6572:
15096 case 6574:
15097 case 7379:
15098 case 11600:
15099 case 11601:
15100 case 12170:
15101 case 19130:
15102 case 25269:
15103 case 25288:
15104 case 28844:
15105 case 30357:
15106 case 37517:
15107 case 40392:
15108 case 57823:
15109 break;
15110 default:
15111 continue;
15112 }
15113 }
15114 break;
15115 // Warrior - Unrelenting Assault
15116 case 64849:
15117 case 64850:
15118 {
15119 if (CastingSpell == nullptr)
15120 continue;
15121 //trigger only on heal spell cast by NOT us
15122 if (!(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_HEALING) || this == victim)
15123 continue;
15124 //this is not counting the bonus effects on heal
15125 auto idx = CastingSpell->firstBeneficialEffect();
15126 if (idx != 1)
15127 {
15128 if (ospinfo)
15129 spell_proc->setOverrideEffectDamage(0, ((CastingSpell->getEffectBasePoints(static_cast<uint8_t>(idx)) + 1) * (ospinfo->calculateEffectValue(0)) / 100));
15130 }
15131 }
15132 break;
15133 //paladin - Light's Grace
15134 case 31834:
15135 {
15136 if (CastingSpell == nullptr)
15137 continue;//this should not occur unless we made a fuckup somewhere
15138
15139 switch (CastingSpell->getId())
15140 {
15141 //SPELL_HASH_HOLY_LIGHT
15142 case 635:
15143 case 639:
15144 case 647:
15145 case 1026:
15146 case 1042:
15147 case 3472:
15148 case 10328:
15149 case 10329:
15150 case 13952:
15151 case 15493:
15152 case 25263:
15153 case 25292:
15154 case 27135:
15155 case 27136:
15156 case 29383:
15157 case 29427:
15158 case 29562:
15159 case 31713:
15160 case 32769:
15161 case 37979:
15162 case 43451:
15163 case 44479:
15164 case 46029:
15165 case 48781:
15166 case 48782:
15167 case 52444:
15168 case 56539:
15169 case 58053:
15170 case 66112:
15171 case 68011:
15172 case 68012:
15173 case 68013:
15174 break;
15175 default:
15176 continue;
15177 }
15178 }
15179 break;
15180 //paladin - Blessed Life
15181 case 31828:
15182 {
15183 //we should test is damage is from environment or not :S
15184 resisted_dmg = (damageInfo.realDamage / 2);
15185 continue; //there is no visual for this ?
15186 }
15187 break;
15188 //paladin - Judgements of the Wise
15189 case 54180:
15190 {
15191 if (CastingSpell == NULL)
15192 continue;
15193 if (CastingSpell->getId() != 53408 && CastingSpell->getId() != 53407 && CastingSpell->getId() != 20271)
15194 continue;
15195 if (!isPlayer())
15196 continue;
15197 }
15198 break;
15199 case 54172: //Paladin - Divine Storm heal effect
15200 {
15201 if (CastingSpell == NULL)
15202 continue;
15203
15204 switch (CastingSpell->getId())
15205 {
15206 //SPELL_HASH_DIVINE_STORM
15207 case 53385:
15208 case 54171:
15209 case 54172:
15210 case 58127:
15211 case 66006:
15212 break;
15213 default:
15214 continue;
15215 }
15216 }
15217 break;
15218 //Energized
15219 case 43751:
15220 {
15221 if (CastingSpell == NULL)
15222 continue;
15223
15224 switch (CastingSpell->getId())
15225 {
15226 //SPELL_HASH_LIGHTNING_BOLT
15227 case 403:
15228 case 529:
15229 case 548:
15230 case 915:
15231 case 943:
15232 case 6041:
15233 case 8246:
15234 case 9532:
15235 case 10391:
15236 case 10392:
15237 case 12167:
15238 case 13482:
15239 case 13527:
15240 case 14109:
15241 case 14119:
15242 case 15207:
15243 case 15208:
15244 case 15234:
15245 case 15801:
15246 case 16782:
15247 case 18081:
15248 case 18089:
15249 case 19874:
15250 case 20295:
15251 case 20802:
15252 case 20805:
15253 case 20824:
15254 case 22414:
15255 case 23592:
15256 case 25448:
15257 case 25449:
15258 case 26098:
15259 case 31764:
15260 case 34345:
15261 case 35010:
15262 case 36152:
15263 case 37273:
15264 case 37661:
15265 case 37664:
15266 case 38465:
15267 case 39065:
15268 case 41184:
15269 case 42024:
15270 case 43526:
15271 case 43903:
15272 case 45075:
15273 case 45284:
15274 case 45286:
15275 case 45287:
15276 case 45288:
15277 case 45289:
15278 case 45290:
15279 case 45291:
15280 case 45292:
15281 case 45293:
15282 case 45294:
15283 case 45295:
15284 case 45296:
15285 case 48698:
15286 case 48895:
15287 case 49237:
15288 case 49238:
15289 case 49239:
15290 case 49240:
15291 case 49418:
15292 case 49454:
15293 case 51587:
15294 case 51618:
15295 case 53044:
15296 case 53314:
15297 case 54843:
15298 case 55044:
15299 case 56326:
15300 case 56891:
15301 case 57780:
15302 case 57781:
15303 case 59006:
15304 case 59024:
15305 case 59081:
15306 case 59169:
15307 case 59199:
15308 case 59683:
15309 case 59863:
15310 case 60009:
15311 case 60032:
15312 case 61374:
15313 case 61893:
15314 case 63809:
15315 case 64098:
15316 case 64696:
15317 case 65987:
15318 case 68112:
15319 case 68113:
15320 case 68114:
15321 case 69567:
15322 case 69970:
15323 case 71136:
15324 case 71934:
15325 break;
15326 default:
15327 continue;
15328 }
15329
15330 }
15331 break;
15332 //Spell Haste Trinket
15333 //http://www.wowhead.com/?item=28190 scarab of the infinite circle
15334 case 33370:
15335 {
15336 if (CastingSpell == NULL)
15337 continue;
15338 if (!(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_DAMAGING))
15339 continue;
15340 }
15341 break;
15342 case 60487: // Extract of Necromantic Power
15343 {
15344 if (CastingSpell == NULL)
15345 continue;
15346 if (!(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_DAMAGING))
15347 continue;
15348 }
15349 break;
15350 case 33953: // The Egg of Mortal essence
15351 {
15352 if (!CastingSpell)
15353 continue;
15354 if (!(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_HEALING))
15355 continue;
15356 }
15357 break;
15358 case 60529: // Forethough Talisman
15359 {
15360 if (!CastingSpell)
15361 continue;
15362 if (!(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_HEALING))
15363 continue;
15364 }
15365 break;
15366 case 53390: //Tidal Waves
15367 {
15368 if (!CastingSpell)
15369 continue;
15370
15371 switch (CastingSpell->getId())
15372 {
15373 //SPELL_HASH_CHAIN_HEAL
15374 case 1064:
15375 case 10622:
15376 case 10623:
15377 case 14900:
15378 case 15799:
15379 case 16367:
15380 case 25422:
15381 case 25423:
15382 case 33642:
15383 case 41114:
15384 case 42027:
15385 case 42477:
15386 case 43527:
15387 case 48894:
15388 case 54481:
15389 case 55458:
15390 case 55459:
15391 case 59473:
15392 case 69923:
15393 case 70425:
15394 case 71120:
15395 case 75370:
15396 //SPELL_HASH_RIPTIDE
15397 case 22419:
15398 case 61295:
15399 case 61299:
15400 case 61300:
15401 case 61301:
15402 case 66053:
15403 case 68118:
15404 case 68119:
15405 case 68120:
15406 case 75367:
15407 break;
15408 default:
15409 continue;
15410 }
15411 }
15412 break;
15413 //Earthliving
15414 case 51945:
15415 case 51990:
15416 case 51997:
15417 case 51998:
15418 case 51999:
15419 case 52000:
15420 {
15421 if (!CastingSpell)
15422 continue;
15423 if (!(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_HEALING))
15424 continue;
15425 }
15426 break;
15427 //shaman - Lightning Overload
15428 case 39805:
15429 {
15430 if (CastingSpell == NULL)
15431 continue; //this should not occur unless we made a fuckup somewhere
15432
15433 //trigger on lightning and chain lightning. Spell should be identical , well maybe next time :P
15434 switch (CastingSpell->getId())
15435 {
15436 //SPELL_HASH_LIGHTNING_BOLT
15437 case 403:
15438 case 529:
15439 case 548:
15440 case 915:
15441 case 943:
15442 case 6041:
15443 case 8246:
15444 case 9532:
15445 case 10391:
15446 case 10392:
15447 case 12167:
15448 case 13482:
15449 case 13527:
15450 case 14109:
15451 case 14119:
15452 case 15207:
15453 case 15208:
15454 case 15234:
15455 case 15801:
15456 case 16782:
15457 case 18081:
15458 case 18089:
15459 case 19874:
15460 case 20295:
15461 case 20802:
15462 case 20805:
15463 case 20824:
15464 case 22414:
15465 case 23592:
15466 case 25448:
15467 case 25449:
15468 case 26098:
15469 case 31764:
15470 case 34345:
15471 case 35010:
15472 case 36152:
15473 case 37273:
15474 case 37661:
15475 case 37664:
15476 case 38465:
15477 case 39065:
15478 case 41184:
15479 case 42024:
15480 case 43526:
15481 case 43903:
15482 case 45075:
15483 case 45284:
15484 case 45286:
15485 case 45287:
15486 case 45288:
15487 case 45289:
15488 case 45290:
15489 case 45291:
15490 case 45292:
15491 case 45293:
15492 case 45294:
15493 case 45295:
15494 case 45296:
15495 case 48698:
15496 case 48895:
15497 case 49237:
15498 case 49238:
15499 case 49239:
15500 case 49240:
15501 case 49418:
15502 case 49454:
15503 case 51587:
15504 case 51618:
15505 case 53044:
15506 case 53314:
15507 case 54843:
15508 case 55044:
15509 case 56326:
15510 case 56891:
15511 case 57780:
15512 case 57781:
15513 case 59006:
15514 case 59024:
15515 case 59081:
15516 case 59169:
15517 case 59199:
15518 case 59683:
15519 case 59863:
15520 case 60009:
15521 case 60032:
15522 case 61374:
15523 case 61893:
15524 case 63809:
15525 case 64098:
15526 case 64696:
15527 case 65987:
15528 case 68112:
15529 case 68113:
15530 case 68114:
15531 case 69567:
15532 case 69970:
15533 case 71136:
15534 case 71934:
15535 //SPELL_HASH_CHAIN_LIGHTNING
15536 case 421:
15537 case 930:
15538 case 2860:
15539 case 10605:
15540 case 12058:
15541 case 15117:
15542 case 15305:
15543 case 15659:
15544 case 16006:
15545 case 16033:
15546 case 16921:
15547 case 20831:
15548 case 21179:
15549 case 22355:
15550 case 23106:
15551 case 23206:
15552 case 24680:
15553 case 25021:
15554 case 25439:
15555 case 25442:
15556 case 27567:
15557 case 28167:
15558 case 28293:
15559 case 28900:
15560 case 31330:
15561 case 31717:
15562 case 32337:
15563 case 33643:
15564 case 37448:
15565 case 39066:
15566 case 39945:
15567 case 40536:
15568 case 41183:
15569 case 42441:
15570 case 42804:
15571 case 43435:
15572 case 44318:
15573 case 45297:
15574 case 45298:
15575 case 45299:
15576 case 45300:
15577 case 45301:
15578 case 45302:
15579 case 45868:
15580 case 46380:
15581 case 48140:
15582 case 48699:
15583 case 49268:
15584 case 49269:
15585 case 49270:
15586 case 49271:
15587 case 50830:
15588 case 52383:
15589 case 54334:
15590 case 54531:
15591 case 59082:
15592 case 59220:
15593 case 59223:
15594 case 59273:
15595 case 59517:
15596 case 59716:
15597 case 59844:
15598 case 61528:
15599 case 61879:
15600 case 62131:
15601 case 63479:
15602 case 64213:
15603 case 64215:
15604 case 64390:
15605 case 64758:
15606 case 64759:
15607 case 67529:
15608 case 68319:
15609 case 69696:
15610 case 75362:
15611 {
15612 castSpell(this, 39805, true);
15613 spellId = CastingSpell->getId();
15614 origId = 39805;
15615 } break;
15616 default:
15617 continue;
15618 }
15619 }
15620 break;
15621 //item - Band of the Eternal Sage
15622 case 35084:
15623 {
15624 if (CastingSpell == NULL)
15625 continue;
15626 if (!(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_DAMAGING)) //requires offensive spell. ! might not cover all spells
15627 continue;
15628 }
15629 break;
15630 //druid - Earth and Moon
15631 case 60431:
15632 case 60432:
15633 case 60433:
15634 {
15635 if (CastingSpell == NULL)
15636 continue;
15637
15638 switch (CastingSpell->getId())
15639 {
15640 //SPELL_HASH_STARFIRE
15641 case 2912:
15642 case 8949:
15643 case 8950:
15644 case 8951:
15645 case 9875:
15646 case 9876:
15647 case 21668:
15648 case 25298:
15649 case 26986:
15650 case 35243:
15651 case 38935:
15652 case 40344:
15653 case 48464:
15654 case 48465:
15655 case 65854:
15656 case 67947:
15657 case 67948:
15658 case 67949:
15659 case 75332:
15660 //SPELL_HASH_WRATH
15661 case 5176:
15662 case 5177:
15663 case 5178:
15664 case 5179:
15665 case 5180:
15666 case 6780:
15667 case 8905:
15668 case 9739:
15669 case 9912:
15670 case 17144:
15671 case 18104:
15672 case 20698:
15673 case 21667:
15674 case 21807:
15675 case 26984:
15676 case 26985:
15677 case 31784:
15678 case 43619:
15679 case 48459:
15680 case 48461:
15681 case 52501:
15682 case 57648:
15683 case 59986:
15684 case 62793:
15685 case 63259:
15686 case 63569:
15687 case 65862:
15688 case 67951:
15689 case 67952:
15690 case 67953:
15691 case 69968:
15692 case 71148:
15693 case 75327:
15694 break;
15695 default:
15696 continue;
15697 }
15698 }
15699 break;
15700 // druid - Celestial Focus
15701 case 16922:
15702 {
15703 if (CastingSpell == NULL)
15704 continue;
15705
15706 switch (CastingSpell->getId())
15707 {
15708 //SPELL_HASH_STARFIRE
15709 case 2912:
15710 case 8949:
15711 case 8950:
15712 case 8951:
15713 case 9875:
15714 case 9876:
15715 case 21668:
15716 case 25298:
15717 case 26986:
15718 case 35243:
15719 case 38935:
15720 case 40344:
15721 case 48464:
15722 case 48465:
15723 case 65854:
15724 case 67947:
15725 case 67948:
15726 case 67949:
15727 case 75332:
15728 break;
15729 default:
15730 continue;
15731 }
15732 }
15733 break;
15734 case 37565: //setbonus
15735 {
15736 if (!CastingSpell)
15737 continue;
15738
15739 switch (CastingSpell->getId())
15740 {
15741 //SPELL_HASH_FLASH_HEAL
15742 case 2061:
15743 case 9472:
15744 case 9473:
15745 case 9474:
15746 case 10915:
15747 case 10916:
15748 case 10917:
15749 case 17137:
15750 case 17138:
15751 case 17843:
15752 case 25233:
15753 case 25235:
15754 case 27608:
15755 case 38588:
15756 case 42420:
15757 case 43431:
15758 case 43516:
15759 case 43575:
15760 case 48070:
15761 case 48071:
15762 case 56331:
15763 case 56919:
15764 case 66104:
15765 case 68023:
15766 case 68024:
15767 case 68025:
15768 case 71595:
15769 case 71782:
15770 case 71783:
15771 break;
15772 default:
15773 continue;
15774 }
15775 }
15776 break;
15777 //SETBONUSES
15778 case 37379:
15779 {
15780 if (!CastingSpell || !(CastingSpell->getSchoolMask() & SCHOOL_MASK_SHADOW) || !(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_DAMAGING))
15781 continue;
15782 }
15783 break;
15784 case 37378:
15785 {
15786 if (!CastingSpell || !(CastingSpell->getSchoolMask() & SCHOOL_MASK_FIRE) || !(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_DAMAGING))
15787 continue;
15788 }
15789 break;
15790 case 45062: // Vial of the Sunwell
15791 case 39950: // Wave Trance
15792 {
15793 if (!CastingSpell || !(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_HEALING))
15794 continue;
15795 }
15796 break;
15797 case 37234:
15798 case 37214:
15799 case 37601:
15800 {
15801 if (!CastingSpell || !(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_DAMAGING))
15802 continue;
15803 }
15804 break;
15805 case 37237:
15806 {
15807 if (!CastingSpell)
15808 continue;
15809
15810 switch (CastingSpell->getId())
15811 {
15812 //SPELL_HASH_LIGHTNING_BOLT
15813 case 403:
15814 case 529:
15815 case 548:
15816 case 915:
15817 case 943:
15818 case 6041:
15819 case 8246:
15820 case 9532:
15821 case 10391:
15822 case 10392:
15823 case 12167:
15824 case 13482:
15825 case 13527:
15826 case 14109:
15827 case 14119:
15828 case 15207:
15829 case 15208:
15830 case 15234:
15831 case 15801:
15832 case 16782:
15833 case 18081:
15834 case 18089:
15835 case 19874:
15836 case 20295:
15837 case 20802:
15838 case 20805:
15839 case 20824:
15840 case 22414:
15841 case 23592:
15842 case 25448:
15843 case 25449:
15844 case 26098:
15845 case 31764:
15846 case 34345:
15847 case 35010:
15848 case 36152:
15849 case 37273:
15850 case 37661:
15851 case 37664:
15852 case 38465:
15853 case 39065:
15854 case 41184:
15855 case 42024:
15856 case 43526:
15857 case 43903:
15858 case 45075:
15859 case 45284:
15860 case 45286:
15861 case 45287:
15862 case 45288:
15863 case 45289:
15864 case 45290:
15865 case 45291:
15866 case 45292:
15867 case 45293:
15868 case 45294:
15869 case 45295:
15870 case 45296:
15871 case 48698:
15872 case 48895:
15873 case 49237:
15874 case 49238:
15875 case 49239:
15876 case 49240:
15877 case 49418:
15878 case 49454:
15879 case 51587:
15880 case 51618:
15881 case 53044:
15882 case 53314:
15883 case 54843:
15884 case 55044:
15885 case 56326:
15886 case 56891:
15887 case 57780:
15888 case 57781:
15889 case 59006:
15890 case 59024:
15891 case 59081:
15892 case 59169:
15893 case 59199:
15894 case 59683:
15895 case 59863:
15896 case 60009:
15897 case 60032:
15898 case 61374:
15899 case 61893:
15900 case 63809:
15901 case 64098:
15902 case 64696:
15903 case 65987:
15904 case 68112:
15905 case 68113:
15906 case 68114:
15907 case 69567:
15908 case 69970:
15909 case 71136:
15910 case 71934:
15911 break;
15912 default:
15913 continue;
15914 }
15915 } break;
15916 //Tier 7 Warlock setbonus
15917 case 61082:
15918 {
15919 if (CastingSpell == NULL)
15920 continue;
15921
15922 switch (CastingSpell->getId())
15923 {
15924 //SPELL_HASH_LIFE_TAP
15925 case 1454:
15926 case 1455:
15927 case 1456:
15928 case 4090:
15929 case 11687:
15930 case 11688:
15931 case 11689:
15932 case 27222:
15933 case 28830:
15934 case 31818:
15935 case 32553:
15936 case 57946:
15937 case 63321:
15938 break;
15939 default:
15940 continue;
15941 }
15942 }
15943 break;
15944 //Tier 5 Paladin setbonus - Crystalforge Battlegear or Crystalforge Raiment
15945 case 37196:
15946 case 43838:
15947 {
15948 if (!CastingSpell)
15949 continue;
15950
15951 switch (CastingSpell->getId())
15952 {
15953 case 31804:
15954 //SPELL_HASH_JUDGEMENT_OF_JUSTICE
15955 case 20184:
15956 case 53407:
15957 //SPELL_HASH_JUDGEMENT_OF_LIGHT
15958 case 20185:
15959 case 20267:
15960 case 20271:
15961 case 28775:
15962 case 57774:
15963 //SPELL_HASH_JUDGEMENT_OF_WISDOM
15964 case 20186:
15965 case 20268:
15966 case 53408:
15967 //SPELL_HASH_JUDGEMENT_OF_RIGHTEOUSNESS
15968 case 20187:
15969 //SPELL_HASH_JUDGEMENT_OF_BLOOD
15970 case 31898:
15971 case 32220:
15972 case 41461:
15973 //SPELL_HASH_JUDGEMENT_OF_COMMAND
15974 case 20425:
15975 case 20467:
15976 case 29386:
15977 case 32778:
15978 case 33554:
15979 case 41368:
15980 case 41470:
15981 case 66005:
15982 case 68017:
15983 case 68018:
15984 case 68019:
15985 case 71551:
15986 break;
15987 default:
15988 continue;
15989 }
15990 }
15991 break;
15992 case 43837:
15993 {
15994 switch (CastingSpell->getId())
15995 {
15996 //SPELL_HASH_FLASH_OF_LIGHT
15997 case 19750:
15998 case 19939:
15999 case 19940:
16000 case 19941:
16001 case 19942:
16002 case 19943:
16003 case 25514:
16004 case 27137:
16005 case 33641:
16006 case 37249:
16007 case 37254:
16008 case 37257:
16009 case 48784:
16010 case 48785:
16011 case 57766:
16012 case 59997:
16013 case 66113:
16014 case 66922:
16015 case 68008:
16016 case 68009:
16017 case 68010:
16018 case 71930:
16019 //SPELL_HASH_HOLY_LIGHT
16020 case 635:
16021 case 639:
16022 case 647:
16023 case 1026:
16024 case 1042:
16025 case 3472:
16026 case 10328:
16027 case 10329:
16028 case 13952:
16029 case 15493:
16030 case 25263:
16031 case 25292:
16032 case 27135:
16033 case 27136:
16034 case 29383:
16035 case 29427:
16036 case 29562:
16037 case 31713:
16038 case 32769:
16039 case 37979:
16040 case 43451:
16041 case 44479:
16042 case 46029:
16043 case 48781:
16044 case 48782:
16045 case 52444:
16046 case 56539:
16047 case 58053:
16048 case 66112:
16049 case 68011:
16050 case 68012:
16051 case 68013:
16052 break;
16053 default:
16054 continue;
16055 }
16056 }
16057 break;
16058 case 37529:
16059 {
16060 switch (CastingSpell->getId())
16061 {
16062 //SPELL_HASH_OVERPOWER
16063 case 7384:
16064 case 7887:
16065 case 11584:
16066 case 11585:
16067 case 14895:
16068 case 17198:
16069 case 24407:
16070 case 32154:
16071 case 37321:
16072 case 37529:
16073 case 43456:
16074 case 58516:
16075 case 65924:
16076 break;
16077 default:
16078 continue;
16079 }
16080 }
16081 break;
16082 case 37517:
16083 {
16084 switch (CastingSpell->getId())
16085 {
16086 //SPELL_HASH_REVENGE
16087 case 6572:
16088 case 6574:
16089 case 7379:
16090 case 11600:
16091 case 11601:
16092 case 12170:
16093 case 19130:
16094 case 25269:
16095 case 25288:
16096 case 28844:
16097 case 30357:
16098 case 40392:
16099 case 57823:
16100 break;
16101 case 37517:
16102 default:
16103 continue;
16104 }
16105 }
16106 break;
16107 case 38333: // Ribbon of Sacrifice
16108 {
16109 if (!CastingSpell || !(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_HEALING))
16110 continue;
16111 }
16112 //SETBONUSES END
16113 //http://www.wowhead.com/?item=32493 Ashtongue Talisman of Shadows
16114 case 40480:
16115 {
16116 if (CastingSpell == NULL)
16117 continue;
16118
16119 switch (CastingSpell->getId())
16120 {
16121 //SPELL_HASH_CORRUPTION
16122 case 172:
16123 case 6222:
16124 case 6223:
16125 case 7648:
16126 case 11671:
16127 case 11672:
16128 case 13530:
16129 case 16402:
16130 case 16985:
16131 case 17510:
16132 case 18088:
16133 case 18376:
16134 case 18656:
16135 case 21068:
16136 case 23642:
16137 case 25311:
16138 case 27216:
16139 case 28829:
16140 case 30938:
16141 case 31405:
16142 case 32063:
16143 case 32197:
16144 case 37113:
16145 case 37961:
16146 case 39212:
16147 case 39621:
16148 case 41988:
16149 case 47782:
16150 case 47812:
16151 case 47813:
16152 case 56898:
16153 case 57645:
16154 case 58811:
16155 case 60016:
16156 case 61563:
16157 case 65810:
16158 case 68133:
16159 case 68134:
16160 case 68135:
16161 case 70602:
16162 case 70904:
16163 case 71937:
16164 break;
16165 default:
16166 continue;
16167 }
16168 }
16169 break;
16170
16171 //http://www.wowhead.com/?item=32496 Memento of Tyrande
16172 case 37656: //don't say damaging spell but EACH time spell is cast there is a chance (so can be healing spell)
16173 {
16174 if (CastingSpell == NULL)
16175 continue;
16176 }
16177 break;
16178 //http://www.wowhead.com/?item=32488 Ashtongue Talisman of Insight
16179 case 40483:
16180 {
16181 if (CastingSpell == NULL)
16182 continue;
16183 if (!(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_DAMAGING))
16184 continue;
16185 }
16186 break;
16187
16188 //http://www.wowhead.com/?item=32487 Ashtongue Talisman of Swiftness
16189 case 40487:
16190 {
16191 switch (CastingSpell->getId())
16192 {
16193 // SPELL_HASH_STEADY_SHOT:
16194 case 34120:
16195 case 49051:
16196 case 49052:
16197 case 56641:
16198 case 65867:
16199 break;
16200 default:
16201 continue;
16202 }
16203 }
16204 break;
16205
16206 //http://www.wowhead.com/?item=32485 Ashtongue Talisman of Valor
16207 case 40459:
16208 {
16209 if (CastingSpell == NULL)
16210 continue;
16211
16212 switch (CastingSpell->getAreaAuraEffect())
16213 {
16214 //SPELL_HASH_SHIELD_SLAM
16215 case 8242:
16216 case 15655:
16217 case 23922:
16218 case 23923:
16219 case 23924:
16220 case 23925:
16221 case 25258:
16222 case 29684:
16223 case 30356:
16224 case 30688:
16225 case 46762:
16226 case 47487:
16227 case 47488:
16228 case 49863:
16229 case 59142:
16230 case 69903:
16231 case 72645:
16232 //SPELL_HASH_BLOODTHIRST
16233 case 23880:
16234 case 23881:
16235 case 23885:
16236 case 23892:
16237 case 23893:
16238 case 23894:
16239 case 25251:
16240 case 30335:
16241 case 30474:
16242 case 30475:
16243 case 30476:
16244 case 31996:
16245 case 31997:
16246 case 31998:
16247 case 33964:
16248 case 35123:
16249 case 35125:
16250 case 35947:
16251 case 35948:
16252 case 35949:
16253 case 39070:
16254 case 39071:
16255 case 39072:
16256 case 40423:
16257 case 55968:
16258 case 55969:
16259 case 55970:
16260 case 57790:
16261 case 57791:
16262 case 57792:
16263 case 60017:
16264 case 71938:
16265 //SPELL_HASH_MORTAL_STRIKE
16266 case 9347:
16267 case 12294:
16268 case 13737:
16269 case 15708:
16270 case 16856:
16271 case 17547:
16272 case 19643:
16273 case 21551:
16274 case 21552:
16275 case 21553:
16276 case 24573:
16277 case 25248:
16278 case 27580:
16279 case 29572:
16280 case 30330:
16281 case 31911:
16282 case 32736:
16283 case 35054:
16284 case 37335:
16285 case 39171:
16286 case 40220:
16287 case 43441:
16288 case 43529:
16289 case 44268:
16290 case 47485:
16291 case 47486:
16292 case 57789:
16293 case 65926:
16294 case 67542:
16295 case 68782:
16296 case 68783:
16297 case 68784:
16298 case 71552:
16299 break;
16300 default:
16301 continue;
16302 }
16303 }
16304 break;
16305 case 28804://Epiphany :Each spell you cast can trigger an Epiphany, increasing your mana regeneration by 24 for 30 sec.
16306 {
16307 if (!CastingSpell)
16308 continue;
16309 }
16310 break;
16311 //SETBONUSES END
16312 //item - Band of the Eternal Restorer
16313 case 35087:
16314 {
16315 if (CastingSpell == NULL)
16316 continue;
16317 if (!(CastingSpell->custom_c_is_flags & SPELL_FLAG_IS_HEALING)) //requires healing spell.
16318 continue;
16319 }
16320 break;
16321
16322 //http://www.wowhead.com/?item=32486 Ashtongue Talisman of Equilibrium
16323 case 40452: //Mangle has a 40% chance to grant 140 Strength for 8 sec
16324 {
16325 if (CastingSpell == NULL)
16326 continue;
16327
16328 switch (CastingSpell->getId())
16329 {
16330 // SPELL_HASH_MANGLE__BEAR_
16331 case 33878:
16332 case 33986:
16333 case 33987:
16334 case 48563:
16335 case 48564:
16336 // SPELL_HASH_MANGLE__CAT_
16337 case 33876:
16338 case 33982:
16339 case 33983:
16340 case 48565:
16341 case 48566:
16342 break;
16343 default:
16344 continue;
16345 }
16346 }
16347 break;
16348 case 40445: //Starfire has a 25% chance to grant up to 150 spell damage for 8 sec
16349 {
16350 if (CastingSpell == NULL)
16351 continue;
16352
16353 switch (CastingSpell->getId())
16354 {
16355 //SPELL_HASH_STARFIRE
16356 case 2912:
16357 case 8949:
16358 case 8950:
16359 case 8951:
16360 case 9875:
16361 case 9876:
16362 case 21668:
16363 case 25298:
16364 case 26986:
16365 case 35243:
16366 case 38935:
16367 case 40344:
16368 case 48464:
16369 case 48465:
16370 case 65854:
16371 case 67947:
16372 case 67948:
16373 case 67949:
16374 case 75332:
16375 break;
16376 default:
16377 continue;
16378 }
16379 }
16380 break;
16381 case 40446: //Rejuvenation has a 25% chance to grant up to 210 healing for 8 sec
16382 {
16383 if (CastingSpell == NULL)
16384 continue;
16385
16386 switch (CastingSpell->getId())
16387 {
16388 //SPELL_HASH_REJUVENATION
16389 case 774:
16390 case 1058:
16391 case 1430:
16392 case 2090:
16393 case 2091:
16394 case 3627:
16395 case 8070:
16396 case 8910:
16397 case 9839:
16398 case 9840:
16399 case 9841:
16400 case 12160:
16401 case 15981:
16402 case 20664:
16403 case 20701:
16404 case 25299:
16405 case 26981:
16406 case 26982:
16407 case 27532:
16408 case 28716:
16409 case 28722:
16410 case 28723:
16411 case 28724:
16412 case 31782:
16413 case 32131:
16414 case 38657:
16415 case 42544:
16416 case 48440:
16417 case 48441:
16418 case 53607:
16419 case 64801:
16420 case 66065:
16421 case 67971:
16422 case 67972:
16423 case 67973:
16424 case 69898:
16425 case 70691:
16426 case 71142:
16427 break;
16428 default:
16429 continue;
16430 }
16431 }
16432 break;
16433
16434 //http://www.wowhead.com/?item=32490 Ashtongue Talisman of Acumen
16435 case 40441: //Each time your Shadow Word: Pain deals damage, it has a 10% chance to grant you 220 spell damage for 10 sec
16436 {
16437 if (CastingSpell == NULL)
16438 continue;
16439
16440 switch (CastingSpell->getId())
16441 {
16442 //SPELL_HASH_SHADOW_WORD__PAIN
16443 case 589:
16444 case 594:
16445 case 970:
16446 case 992:
16447 case 2767:
16448 case 10892:
16449 case 10893:
16450 case 10894:
16451 case 11639:
16452 case 14032:
16453 case 15654:
16454 case 17146:
16455 case 19776:
16456 case 23268:
16457 case 23952:
16458 case 24212:
16459 case 25367:
16460 case 25368:
16461 case 27605:
16462 case 30854:
16463 case 30898:
16464 case 34441:
16465 case 34941:
16466 case 34942:
16467 case 37275:
16468 case 41355:
16469 case 46560:
16470 case 48124:
16471 case 48125:
16472 case 57778:
16473 case 59864:
16474 case 60005:
16475 case 60446:
16476 case 65541:
16477 case 68088:
16478 case 68089:
16479 case 68090:
16480 case 72318:
16481 case 72319:
16482 break;
16483 default:
16484 continue;
16485 }
16486 }
16487 break;
16488
16489 //http://www.wowhead.com/?item=32490 Ashtongue Talisman of Acumen
16490 case 40440: //Each time your Renew heals, it has a 10% chance to grant you 220 healing for 5 sec
16491 {
16492 if (CastingSpell == NULL)
16493 continue;
16494
16495 switch (CastingSpell->getId())
16496 {
16497 //SPELL_HASH_RENEW
16498 case 139:
16499 case 6074:
16500 case 6075:
16501 case 6076:
16502 case 6077:
16503 case 6078:
16504 case 8362:
16505 case 10927:
16506 case 10928:
16507 case 10929:
16508 case 11640:
16509 case 22168:
16510 case 23895:
16511 case 25058:
16512 case 25221:
16513 case 25222:
16514 case 25315:
16515 case 27606:
16516 case 28807:
16517 case 31325:
16518 case 34423:
16519 case 36679:
16520 case 36969:
16521 case 37260:
16522 case 37978:
16523 case 38210:
16524 case 41456:
16525 case 44174:
16526 case 45859:
16527 case 46192:
16528 case 46563:
16529 case 47079:
16530 case 48067:
16531 case 48068:
16532 case 49263:
16533 case 56332:
16534 case 57777:
16535 case 60004:
16536 case 61967:
16537 case 62333:
16538 case 62441:
16539 case 66177:
16540 case 66537:
16541 case 67675:
16542 case 68035:
16543 case 68036:
16544 case 68037:
16545 case 71932:
16546 break;
16547 default:
16548 continue;
16549 }
16550 }
16551 break;
16552
16553 //http://www.wowhead.com/?item=32492 Ashtongue Talisman of Lethality
16554 case 37445: //using a mana gem grants you 225 spell damage for 15 sec
16555 {
16556 if (!CastingSpell)
16557 continue;
16558
16559 switch (CastingSpell->getId())
16560 {
16561 //SPELL_HASH_REPLENISH_MANA
16562 case 5405:
16563 case 10052:
16564 case 10057:
16565 case 10058:
16566 case 18385:
16567 case 27103:
16568 case 33394:
16569 case 42987:
16570 case 42988:
16571 case 71565:
16572 case 71574:
16573 break;
16574 default:
16575 continue;
16576 }
16577 }
16578 break;
16579 case 16886: // druid - Nature's Grace
16580 {
16581 // Remove aura if it exists so it gets reapplied
16582 removeAllAurasById(16886);
16583 }
16584 break;
16585 case 38395:
16586 {
16587 if (CastingSpell == NULL)
16588 continue;
16589
16590 switch (CastingSpell->getId())
16591 {
16592 //SPELL_HASH_IMMOLATE
16593 case 348:
16594 case 707:
16595 case 1094:
16596 case 2941:
16597 case 8981:
16598 case 9034:
16599 case 9275:
16600 case 9276:
16601 case 11665:
16602 case 11667:
16603 case 11668:
16604 case 11962:
16605 case 11984:
16606 case 12742:
16607 case 15505:
16608 case 15506:
16609 case 15570:
16610 case 15661:
16611 case 15732:
16612 case 15733:
16613 case 17883:
16614 case 18542:
16615 case 20294:
16616 case 20787:
16617 case 20800:
16618 case 20826:
16619 case 25309:
16620 case 27215:
16621 case 29928:
16622 case 36637:
16623 case 36638:
16624 case 37668:
16625 case 38805:
16626 case 38806:
16627 case 41958:
16628 case 44267:
16629 case 44518:
16630 case 46042:
16631 case 46191:
16632 case 47810:
16633 case 47811:
16634 case 75383:
16635 //SPELL_HASH_CORRUPTION
16636 case 172:
16637 case 6222:
16638 case 6223:
16639 case 7648:
16640 case 11671:
16641 case 11672:
16642 case 13530:
16643 case 16402:
16644 case 16985:
16645 case 17510:
16646 case 18088:
16647 case 18376:
16648 case 18656:
16649 case 21068:
16650 case 23642:
16651 case 25311:
16652 case 27216:
16653 case 28829:
16654 case 30938:
16655 case 31405:
16656 case 32063:
16657 case 32197:
16658 case 37113:
16659 case 37961:
16660 case 39212:
16661 case 39621:
16662 case 41988:
16663 case 47782:
16664 case 47812:
16665 case 47813:
16666 case 56898:
16667 case 57645:
16668 case 58811:
16669 case 60016:
16670 case 61563:
16671 case 65810:
16672 case 68133:
16673 case 68134:
16674 case 68135:
16675 case 70602:
16676 case 70904:
16677 case 71937:
16678 break;
16679 default:
16680 continue;
16681 }
16682 }
16683 break;
16684 }
16685 }
16686
16687 if (spellId == 17364 || spellId == 32175 || spellId == 32176) //Stormstrike
16688 continue;
16689 if (spellId == 22858 && isInBack(victim)) //retatliation needs target to be not in front. Can be cast by creatures too
16690 continue;
16691
16692 spell_proc->castSpell(victim, CastingSpell);
16693
16694 if (origId == 39805)
16695 {
16696 removeAllAurasById(39805); // Remove lightning overload aura after procing
16697 }
16698
16699 if (spell_proc->getCreatedByAura() != nullptr)
16700 happenedProcs.push_back(spell_proc);
16701 }
16702
16703 if (!happenedProcs.empty())
16704 {
16705 for (auto procItr = happenedProcs.begin(); procItr != happenedProcs.end();)
16706 {
16707 auto proc = *procItr;
16708 if (proc->getCreatedByAura() != nullptr)
16709 proc->getCreatedByAura()->removeCharge();
16710
16711 procItr = happenedProcs.erase(procItr);
16712 }
16713 }
16714
16715 // Leaving old hackfixes commented here -Appled
16716 /*switch (iter2->second.spellId)
16717 {
16718 case 43339: // Shaman - Shamanist Focus
16719 {
16720 switch (CastingSpell->getId())
16721 {
16722 //SPELL_HASH_EARTH_SHOCK
16723 case 8042:
16724 case 8044:
16725 case 8045:
16726 case 8046:
16727 case 10412:
16728 case 10413:
16729 case 10414:
16730 case 13281:
16731 case 13728:
16732 case 15501:
16733 case 22885:
16734 case 23114:
16735 case 24685:
16736 case 25025:
16737 case 25454:
16738 case 26194:
16739 case 43305:
16740 case 47071:
16741 case 49230:
16742 case 49231:
16743 case 54511:
16744 case 56506:
16745 case 57783:
16746 case 60011:
16747 case 61668:
16748 case 65973:
16749 case 68100:
16750 case 68101:
16751 case 68102:
16752 //SPELL_HASH_FLAME_SHOCK
16753 case 8050:
16754 case 8052:
16755 case 8053:
16756 case 10447:
16757 case 10448:
16758 case 13729:
16759 case 15039:
16760 case 15096:
16761 case 15616:
16762 case 16804:
16763 case 22423:
16764 case 23038:
16765 case 25457:
16766 case 29228:
16767 case 32967:
16768 case 34354:
16769 case 39529:
16770 case 39590:
16771 case 41115:
16772 case 43303:
16773 case 49232:
16774 case 49233:
16775 case 51588:
16776 case 55613:
16777 case 58940:
16778 case 58971:
16779 case 59684:
16780 //SPELL_HASH_FROST_SHOCK
16781 case 8056:
16782 case 8058:
16783 case 10472:
16784 case 10473:
16785 case 12548:
16786 case 15089:
16787 case 15499:
16788 case 19133:
16789 case 21030:
16790 case 21401:
16791 case 22582:
16792 case 23115:
16793 case 25464:
16794 case 29666:
16795 case 34353:
16796 case 37332:
16797 case 37865:
16798 case 38234:
16799 case 39062:
16800 case 41116:
16801 case 43524:
16802 case 46180:
16803 case 49235:
16804 case 49236:
16805 break;
16806 default:
16807 continue;
16808 }
16809 }
16810 break;
16811 case 12043: // Mage - Presence of Mind
16812 {
16813 //if (!sd->CastTime||sd->CastTime>10000) continue;
16814 if (spell_cast_time->CastTime == 0)
16815 continue;
16816 }
16817 break;
16818 case 17116: // Shaman - Nature's Swiftness
16819 case 16188: // Druid - Nature's Swiftness
16820 {
16821 //if (CastingSpell->School!=SCHOOL_NATURE||(!sd->CastTime||sd->CastTime>10000)) continue;
16822 if (!(CastingSpell->getSchoolMask() & SCHOOL_MASK_NATURE) || spell_cast_time->CastTime == 0)
16823 continue;
16824 }
16825 break;
16826 case 16166:
16827 {
16828 if (!(CastingSpell->getSchoolMask() & SCHOOL_MASK_FIRE || CastingSpell->getSchoolMask() & SCHOOL_MASK_FROST || CastingSpell->getSchoolMask() & SCHOOL_MASK_NATURE))
16829 continue;
16830 }
16831 break;
16832 case 14177: // Cold blood will get removed on offensive spell
16833 {
16834 if (!(CastingSpell->getSpellFamilyFlags(0) & 0x6820206 || CastingSpell->getSpellFamilyFlags(1) & 0x240009))
16835 continue;
16836 }
16837 break;
16838 case 46916: // Bloodsurge - Slam! effect should dissapear after casting Slam only
16839 {
16840 switch (CastingSpell->getId())
16841 {
16842 //SPELL_HASH_SLAM
16843 case 1464:
16844 case 8820:
16845 case 11430:
16846 case 11604:
16847 case 11605:
16848 case 25241:
16849 case 25242:
16850 case 34620:
16851 case 47474:
16852 case 47475:
16853 case 50782:
16854 case 50783:
16855 case 52026:
16856 case 67028:
16857 break;
16858 default:
16859 continue;
16860 }
16861
16862 }
16863 break;
16864 case 60503: // Taste for Blood should dissapear after casting Overpower
16865 {
16866 switch (CastingSpell->getId())
16867 {
16868 //SPELL_HASH_OVERPOWER
16869 case 7384:
16870 case 7887:
16871 case 11584:
16872 case 11585:
16873 case 14895:
16874 case 17198:
16875 case 24407:
16876 case 32154:
16877 case 37321:
16878 case 37529:
16879 case 43456:
16880 case 58516:
16881 case 65924:
16882 break;
16883 default:
16884 continue;
16885 }
16886 }
16887 break;
16888 case 23694: // Imp. Hamstring
16889 {
16890 switch (CastingSpell->getId())
16891 {
16892 //SPELL_HASH_IMPROVED_HAMSTRING
16893 case 12289:
16894 case 12668:
16895 case 23694:
16896 case 23695:
16897 case 24428:
16898 break;
16899 default:
16900 continue;
16901 }
16902 }
16903 break;
16904 case 65156: // Juggernaut
16905 {
16906 switch (CastingSpell->getId())
16907 {
16908 //SPELL_HASH_MORTAL_STRIKE
16909 case 9347:
16910 case 12294:
16911 case 13737:
16912 case 15708:
16913 case 16856:
16914 case 17547:
16915 case 19643:
16916 case 21551:
16917 case 21552:
16918 case 21553:
16919 case 24573:
16920 case 25248:
16921 case 27580:
16922 case 29572:
16923 case 30330:
16924 case 31911:
16925 case 32736:
16926 case 35054:
16927 case 37335:
16928 case 39171:
16929 case 40220:
16930 case 43441:
16931 case 43529:
16932 case 44268:
16933 case 47485:
16934 case 47486:
16935 case 57789:
16936 case 65926:
16937 case 67542:
16938 case 68782:
16939 case 68783:
16940 case 68784:
16941 case 71552:
16942 //SPELL_HASH_SLAM
16943 case 1464:
16944 case 8820:
16945 case 11430:
16946 case 11604:
16947 case 11605:
16948 case 25241:
16949 case 25242:
16950 case 34620:
16951 case 47474:
16952 case 47475:
16953 case 50782:
16954 case 50783:
16955 case 52026:
16956 case 67028:
16957 break;
16958 default:
16959 continue;
16960 }
16961 }
16962 break;
16963 }*/
16964
16965 if (can_delete) //are we the upper level of nested procs ? If yes then we can remove the lock
16966 m_isProcInUse = false;
16967
16968 return resisted_dmg;
16969}
@ SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
@ INVTYPE_WEAPON
@ PROC_ON_DONE_PERIODIC
Definition ProcFlags.hpp:36
@ SCHOOL_MASK_FROST
Definition School.hpp:29
@ SCHOOL_MASK_SHADOW
Definition School.hpp:30
@ SCHOOL_MASK_FIRE
Definition School.hpp:27
@ SKILL_DESTRUCTION
Definition Skill.hpp:146
@ SKILL_SWORDS
Definition Skill.hpp:24
@ SKILL_2H_SWORDS
Definition Skill.hpp:33
@ PROC_EVENT_DO_CASTER_PROCS_ONLY
@ PROC_EVENT_DO_TARGET_PROCS_ONLY
@ SPELL_EFFECT_ADD_COMBO_POINTS
@ SPELL_FLAG_IS_DAMAGING
@ SPELL_FLAG_IS_FINISHING_MOVE
@ SPELL_FLAG_IS_HEALING
@ SPELLMOD_TRIGGER
SERVER_DECL WDB::WDBContainer< WDB::Structures::SpellDurationEntry > sSpellDurationStore
uint32_t SERVER_DECL GetDuration(WDB::Structures::SpellDurationEntry const *dur)
Definition WDBStores.cpp:38
SERVER_DECL WDB::WDBContainer< WDB::Structures::SpellShapeshiftFormEntry > sSpellShapeshiftFormStore
void setCharges(uint16_t count, bool sendUpdatePacket=true)
ItemProperties const * getItemProperties() const
Definition Item.cpp:954
DamageInfo doSpellHealing(Unit *victim, uint32_t spellId, float_t heal, bool isTriggered=false, bool isPeriodic=false, bool isLeech=false, bool forceCrit=false, Spell *spell=nullptr, Aura *aur=nullptr, AuraEffectModifier *aurEff=nullptr)
Definition Object.cpp:1132
DamageInfo doSpellDamage(Unit *victim, uint32_t spellId, float_t damage, uint8_t effIndex, bool isTriggered=false, bool isPeriodic=false, bool isLeech=false, bool forceCrit=false, Spell *spell=nullptr, Aura *aur=nullptr, AuraEffectModifier *aurEff=nullptr)
Definition Object.cpp:771
bool isInBack(Object *target)
Definition Object.cpp:3791
bool isInFeralForm()
Definition Player.cpp:4113
int32_t calculateEffectValue(uint8_t effIndex, Unit *unitCaster=nullptr, Item *itemCaster=nullptr, SpellForcedBasePoints forcedBasePoints=SpellForcedBasePoints()) const
void deleteProc()
virtual void castSpell(Unit *victim, SpellInfo const *CastingSpell)
Definition SpellProc.cpp:96
SpellInfo const * getSpell() const
SpellInfo const * getOriginalSpell() const
Aura * getCreatedByAura() const
uint32_t getProcInterval() const
void setOverrideEffectDamage(uint8_t effIndex, int32_t damage)
Unit * getProcOwner() const
float_t getProcsPerMinute() const
void skipOnNextHandleProc(bool)
bool checkClassMask(SpellInfo const *castingSpell) const
Definition SpellProc.cpp:66
void setLastTriggerTime(uint32_t time)
virtual bool canProc(Unit *victim, SpellInfo const *castingSpell)
Definition SpellProc.cpp:25
bool isCastedOnProcOwner() const
bool isSkippingHandleProc() const
bool checkExtraProcFlags(Unit *procOwner, DamageInfo damageInfo) const
Definition SpellProc.cpp:30
virtual bool doEffect(Unit *victim, SpellInfo const *castingSpell, uint32_t procFlag, uint32_t dmg, uint32_t abs, uint32_t weapon_damage_type)
Definition SpellProc.cpp:82
uint32_t getLastTriggerTime() const
void setUnitTarget(Unit *_unit)
Definition Spell.cpp:5681
bool m_isProcInUse
Definition Unit.hpp:1499
DamageInfo strike(Unit *pVictim, WeaponDamageType weaponType, SpellInfo const *ability, int32_t add_damage, int32_t pct_dmg_mod, uint32_t exclusive_damage, bool disable_proc, bool skip_hit_check, bool force_crit=false, Spell *castingSpell=nullptr)
Definition Unit.cpp:10407
uint32_t getRandomUInt(uint32_t end)
Definition Random.cpp:32
WeaponDamageType weaponType
uint32_t realDamage
bool isCritical
uint32_t absorbedDamage
Here is the caller graph for this function:

◆ handleProcDmgShield()

void Unit::handleProcDmgShield ( uint32_t  flag,
Unit attacker 
)

Definition at line 16972 of file Unit.cpp.

16973{
16974 //make sure we do not loop dmg procs
16975 if (this == attacker || !attacker)
16976 return;
16978 return;
16979 m_damageShieldsInUse = true;
16980
16981 //charges are already removed in handleproc
16982 for (std::list<DamageProc>::iterator i = m_damageShields.begin(); i != m_damageShields.end();) // Deal Damage to Attacker
16983 {
16984 std::list<DamageProc>::iterator i2 = i++; //we should not proc on proc.. not get here again.. not needed.Better safe then sorry.
16985 if ((flag & (*i2).m_flags))
16986 {
16987 {
16988 if (const auto spellInfo = sSpellMgr.getSpellInfo((*i2).m_spellId))
16989 {
16990 sendMessageToSet(SmsgSpellDamageShield(this->getGuid(), attacker->getGuid(), spellInfo->getId(), (*i2).m_damage, spellInfo->getSchoolMask()).serialise().get(), true);
16991 addSimpleDamageBatchEvent((*i2).m_damage, this);
16992 }
16993 }
16994 }
16995 }
16996 m_damageShieldsInUse = false;
16997}
void addSimpleDamageBatchEvent(uint32_t damage, Unit *attacker=nullptr, SpellInfo const *spellInfo=nullptr)
Definition Unit.cpp:7371
bool m_damageShieldsInUse
Definition Unit.hpp:1325
std::list< DamageProc > m_damageShields
Definition Unit.hpp:1326
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSpellClick()

void Unit::handleSpellClick ( Unit clicker)

First check simple relations from clicker to clickee

Definition at line 8505 of file Unit.cpp.

8506{
8507 bool spellClickHandled = false;
8508 uint32_t spellClickEntry = getEntry();
8509
8510 std::vector<SpellClickInfo> clickBounds = sMySQLStore.getSpellClickInfo(spellClickEntry);
8511 for (const auto& clickPair : clickBounds)
8512 {
8513 //! First check simple relations from clicker to clickee
8514 if (!clickPair.isFitToRequirements(clicker, this))
8515 continue;
8516
8517 Unit* caster = (clickPair.castFlags & NPC_CLICK_CAST_CASTER_CLICKER) ? clicker : this;
8518 Unit* target = (clickPair.castFlags & NPC_CLICK_CAST_TARGET_CLICKER) ? clicker : this;
8519 auto* const unitOwner = getUnitOwner();
8520 uint64_t origCasterGUID = (unitOwner && clickPair.castFlags & NPC_CLICK_CAST_ORIG_CASTER_OWNER) ? unitOwner->getGuid() : clicker->getGuid();
8521
8522 SpellInfo const* spellEntry = sSpellMgr.getSpellInfo(clickPair.spellId);
8523
8524 // Creatures like Lightwell...
8525 if (IsInMap(caster))
8526 caster->castSpell(target, spellEntry->getId(), true);
8527
8528 spellClickHandled = true;
8529 }
8530
8531 if (isCreature())
8532 {
8533 if (CreatureAIScript* ai = ToCreature()->GetScript())
8534 {
8535 ai->OnSpellClick(clicker, spellClickHandled);
8536 }
8537 }
8538}
@ NPC_CLICK_CAST_TARGET_CLICKER
@ NPC_CLICK_CAST_ORIG_CASTER_OWNER
@ NPC_CLICK_CAST_CASTER_CLICKER
CreatureAIScript * GetScript()
virtual Unit * getUnitOwner()
Definition Object.cpp:1747
Creature * ToCreature()
Definition Object.hpp:393
uint32_t getEntry() const
Definition Object.cpp:382
bool IsInMap(Object *obj)
Definition Object.hpp:442
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasAuraState()

bool Unit::hasAuraState ( AuraState  state,
SpellInfo const spellInfo = nullptr,
Unit const caster = nullptr 
) const

Definition at line 5130 of file Unit.cpp.

5131{
5132#if VERSION_STRING >= WotLK
5133 if (caster != nullptr && spellInfo != nullptr && caster->hasAuraWithAuraEffect(SPELL_AURA_IGNORE_TARGET_AURA_STATE))
5134 {
5135 const auto& auraStateList = caster->getAuraEffectList(SPELL_AURA_IGNORE_TARGET_AURA_STATE);
5136 for (const auto& aurEff : auraStateList)
5137 {
5138 if (aurEff->getAura()->getSpellInfo()->isAuraEffectAffectingSpell(SPELL_AURA_IGNORE_TARGET_AURA_STATE, spellInfo))
5139 return true;
5140 }
5141 }
5142#endif
5143
5144 return getAuraState() & (1 << (state - 1));
5145}
state
Definition core.h:2305
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasAurasWithId() [1/2]

bool Unit::hasAurasWithId ( uint32_t  auraId) const

Definition at line 5004 of file Unit.cpp.

5005{
5006 for (const auto& aur : getAuraList())
5007 {
5008 if (aur && aur->getSpellId() == auraId)
5009 return true;
5010 }
5011
5012 return false;
5013}
Here is the call graph for this function:

◆ hasAurasWithId() [2/2]

bool Unit::hasAurasWithId ( uint32_t const auraId) const

Definition at line 5015 of file Unit.cpp.

5016{
5017 for (const auto& aur : getAuraList())
5018 {
5019 if (aur == nullptr)
5020 continue;
5021
5022 for (int i = 0; auraId[i] != 0; ++i)
5023 {
5024 if (aur->getSpellId() == auraId[i])
5025 return true;
5026 }
5027 }
5028
5029 return false;
5030}
Here is the call graph for this function:

◆ hasAurasWithIdForGuid() [1/2]

bool Unit::hasAurasWithIdForGuid ( uint32_t  auraId,
uint64_t  guid 
) const

Definition at line 5032 of file Unit.cpp.

5033{
5034 for (const auto& aur : m_auraList)
5035 {
5036 if (aur && aur->getSpellId() == auraId && aur->getCasterGuid() == guid)
5037 return true;
5038 }
5039
5040 return false;
5041}
Here is the call graph for this function:

◆ hasAurasWithIdForGuid() [2/2]

bool Unit::hasAurasWithIdForGuid ( uint32_t const auraId,
uint64_t  guid 
) const

Definition at line 5043 of file Unit.cpp.

5044{
5045 for (const auto& aur : m_auraList)
5046 {
5047 if (aur == nullptr)
5048 continue;
5049
5050 for (int i = 0; auraId[i] != 0; ++i)
5051 {
5052 if (aur->getSpellId() == auraId[i] && aur->getCasterGuid() == guid)
5053 return true;
5054 }
5055 }
5056
5057 return false;
5058}
Here is the call graph for this function:

◆ hasAuraWithAuraEffect()

bool Unit::hasAuraWithAuraEffect ( AuraEffect  type) const

Definition at line 5060 of file Unit.cpp.

5061{
5062 if (type >= TOTAL_SPELL_AURAS)
5063 return false;
5064
5065 return !getAuraEffectList(type).empty();
5066}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasAuraWithAuraEffectForGuid()

bool Unit::hasAuraWithAuraEffectForGuid ( AuraEffect  type,
uint64_t  guid 
) const

Definition at line 5068 of file Unit.cpp.

5069{
5070 if (type >= TOTAL_SPELL_AURAS)
5071 return false;
5072
5073 for (const auto& aurEff : m_auraEffectList[type])
5074 {
5075 if (aurEff->getAura()->getCasterGuid() == guid)
5076 return true;
5077 }
5078
5079 return false;
5080}

◆ hasAuraWithMechanic()

bool Unit::hasAuraWithMechanic ( SpellMechanic  mechanic) const

Definition at line 5082 of file Unit.cpp.

5083{
5084 for (const auto& aur : getAuraList())
5085 {
5086 if (aur == nullptr)
5087 continue;
5088
5089 if (aur->getSpellInfo()->getMechanicsType() == mechanic)
5090 {
5091 return true;
5092 }
5093 else
5094 {
5095 for (uint8_t i = 0; i < MAX_SPELL_EFFECTS; ++i)
5096 {
5097 if (aur->getAuraEffect(i)->getAuraEffectType() == SPELL_AURA_NONE)
5098 continue;
5099
5100 if (aur->getSpellInfo()->getEffectMechanic(i) == mechanic)
5101 return true;
5102 }
5103 }
5104 }
5105
5106 return false;
5107}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasAuraWithSpellType()

bool Unit::hasAuraWithSpellType ( SpellTypes  type,
uint64_t  casterGuid = 0,
uint32_t  skipSpellId = 0 
) const

Definition at line 5109 of file Unit.cpp.

5110{
5111 const uint64_t sGuid = type == SPELL_TYPE_BLESSING || type == SPELL_TYPE_WARRIOR_SHOUT ? casterGuid : 0;
5112 for (const auto& aur : getAuraList())
5113 {
5114 if (aur == nullptr)
5115 continue;
5116
5117 if (skipSpellId != 0 && aur->getSpellId() == skipSpellId)
5118 continue;
5119
5120 if (!(aur->getSpellInfo()->custom_BGR_one_buff_on_target & type))
5121 continue;
5122
5123 if (sGuid == 0 || aur->getCasterGuid() == sGuid)
5124 return true;
5125 }
5126
5127 return false;
5128}
@ SPELL_TYPE_BLESSING
@ SPELL_TYPE_WARRIOR_SHOUT
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasExtraUnitMovementFlag()

bool Unit::hasExtraUnitMovementFlag ( uint16_t  f2) const

Definition at line 1942 of file Unit.cpp.

1942{ return (obj_movement_info.flags2 & f2) != 0; }
Here is the caller graph for this function:

◆ hasNoInterrupt()

uint16_t Unit::hasNoInterrupt ( ) const
inline

Definition at line 1235 of file Unit.hpp.

1235{ return m_noInterrupt; }
uint16_t m_noInterrupt
Definition Unit.hpp:1236
Here is the caller graph for this function:

◆ hasSpellImmunity()

bool Unit::hasSpellImmunity ( SpellImmunityMask  immunityMask) const

Definition at line 4530 of file Unit.cpp.

4531{
4532 return m_spellImmunityMask & immunityMask;
4533}
Here is the caller graph for this function:

◆ hasUnitFlags()

bool Unit::hasUnitFlags ( uint32_t  unitFlags) const

Definition at line 1111 of file Unit.cpp.

1111{ return (getUnitFlags() & unitFlags) != 0; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasUnitMovementFlag()

bool Unit::hasUnitMovementFlag ( uint32_t  f) const

Definition at line 1937 of file Unit.cpp.

1937{ return (obj_movement_info.flags & f) != 0; }
Here is the caller graph for this function:

◆ hasUnitStateFlag()

bool Unit::hasUnitStateFlag ( uint32_t  state_flag) const
inline

Definition at line 717 of file Unit.hpp.

717{ return (m_unitState & state_flag ? true : false); }
Here is the caller graph for this function:

◆ interruptHealthRegeneration()

void Unit::interruptHealthRegeneration ( uint32_t  timeInMS)

Definition at line 6653 of file Unit.cpp.

6654{
6656}
uint32_t m_healthRegenerationInterruptTime
Definition Unit.hpp:963
Here is the caller graph for this function:

◆ isAIEnabled()

bool Unit::isAIEnabled ( )
inline

Definition at line 708 of file Unit.hpp.

708{ return m_useAI; }
Here is the caller graph for this function:

◆ isAlive()

bool Unit::isAlive ( ) const

Definition at line 7871 of file Unit.cpp.

7871{ return m_deathState == ALIVE; }
@ ALIVE

◆ isAttackReady()

bool Unit::isAttackReady ( WeaponDamageType  type) const

Definition at line 6912 of file Unit.cpp.

6913{
6914 return Util::getMSTime() >= m_attackTimer[type];
6915}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isCharmed()

bool Unit::isCharmed ( ) const
inline

Definition at line 189 of file Unit.hpp.

189{ return !getCharmedByGuid(); }
Here is the caller graph for this function:

◆ isCriticalDamageForSpell()

bool Unit::isCriticalDamageForSpell ( Object target,
Spell spell 
)

Definition at line 4155 of file Unit.cpp.

4156{
4157 // Spell cannot crit against gameobjects or items
4158 if (!target->isCreatureOrPlayer())
4159 return false;
4160
4161 return Util::checkChance(getCriticalChanceForDamageSpell(spell, nullptr, dynamic_cast<Unit*>(target)));
4162}
float_t getCriticalChanceForDamageSpell(Spell *spell, Aura *aura, Unit *target)
Definition Unit.cpp:4045
Here is the call graph for this function:

◆ isCriticalHealForSpell()

bool Unit::isCriticalHealForSpell ( Object target,
Spell spell 
)

Definition at line 4164 of file Unit.cpp.

4165{
4166 // Spell cannot crit against gameobjects or items
4167 if (!target->isCreatureOrPlayer())
4168 return false;
4169
4170 return Util::checkChance(getCriticalChanceForHealSpell(spell, nullptr, dynamic_cast<Unit*>(target)));
4171}
float_t getCriticalChanceForHealSpell(Spell *spell, Aura *aura, Unit *target)
Definition Unit.cpp:4131
Here is the call graph for this function:

◆ isCritter()

virtual bool Unit::isCritter ( )
inlinevirtual

Reimplemented in Creature.

Definition at line 1075 of file Unit.hpp.

1075{ return false; }
Here is the caller graph for this function:

◆ isDazed()

bool Unit::isDazed ( ) const

Definition at line 5774 of file Unit.cpp.

5775{
5776 for (const auto& aur : getAuraList())
5777 {
5778 if (aur)
5779 {
5780 if (aur->getSpellInfo()->getMechanicsType() == MECHANIC_ENSNARED)
5781 return true;
5782
5783 for (uint8_t y = 0; y < 3;++y)
5784 if (aur->getSpellInfo()->getEffectMechanic(y) == MECHANIC_ENSNARED)
5785 return true;
5786 }
5787 }
5788
5789 return false;
5790}
@ MECHANIC_ENSNARED
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isDead()

bool Unit::isDead ( ) const

Definition at line 7872 of file Unit.cpp.

7872{ return m_deathState != ALIVE; }
Here is the caller graph for this function:

◆ IsFalling()

bool Unit::IsFalling ( ) const

Definition at line 1950 of file Unit.cpp.

1951{
1953}
@ MOVEFLAG_FALLING_MASK
bool hasMovementFlag(MovementFlags _flags) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isFeared()

uint32_t Unit::isFeared ( ) const
inline

Definition at line 1354 of file Unit.hpp.

1354{ return m_fearModifiers; }
int32_t m_fearModifiers
Definition Unit.hpp:1355
Here is the caller graph for this function:

◆ isFfaPvpFlagSet()

bool Unit::isFfaPvpFlagSet ( ) const
virtual

Reimplemented in Creature, and Player.

Definition at line 6944 of file Unit.cpp.

6944{ return false; }
Here is the caller graph for this function:

◆ IsFlying()

bool Unit::IsFlying ( ) const
inline

Definition at line 583 of file Unit.hpp.

Here is the caller graph for this function:

◆ isHealthRegenerationInterrupted()

bool Unit::isHealthRegenerationInterrupted ( ) const

Definition at line 6658 of file Unit.cpp.

6659{
6660 return m_healthRegenerateTimer != 0;
6661}
uint16_t m_healthRegenerateTimer
Definition Unit.hpp:973

◆ isHovering()

bool Unit::isHovering ( ) const
inline

Definition at line 587 of file Unit.hpp.

Here is the caller graph for this function:

◆ isInAccessiblePlaceFor()

bool Unit::isInAccessiblePlaceFor ( Creature c) const

Definition at line 1790 of file Unit.cpp.

1791{
1792 if (isInWater())
1793 return c->canSwim();
1794
1795 if (IsFlying() && !GetTransport()) // we could be flying antihack!
1796 return c->canFly();
1797
1798 return c->canWalk() || c->canFly();
1799}
bool canSwim() override
Definition Creature.h:163
bool canFly() override
Definition Creature.h:164
bool canWalk()
Definition Creature.h:162
bool IsFlying() const
Definition Unit.hpp:583
virtual bool isInWater() const
Definition Unit.cpp:1770
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isInCombat()

bool Unit::isInCombat ( ) const
inline

Definition at line 289 of file Unit.hpp.

289{ return getCombatHandler().isInCombat(); }
bool isInCombat() const
Here is the caller graph for this function:

◆ isInCombatWith()

bool Unit::isInCombatWith ( Unit const victim) const
inline

Definition at line 290 of file Unit.hpp.

290{ return victim && getCombatHandler().isInPreCombatWithUnit(victim); }
bool isInPreCombatWithUnit(Unit const *unit) const

◆ isInEvadeMode()

bool Unit::isInEvadeMode ( ) const
inline

Definition at line 722 of file Unit.hpp.

Here is the caller graph for this function:

◆ isInInstance()

bool Unit::isInInstance ( ) const

Definition at line 1765 of file Unit.cpp.

1766{
1767 return IsInWorld() && !getWorldMap()->getBaseMap()->isWorldMap();
1768}
bool isWorldMap() const
Definition BaseMap.cpp:110
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isInvisible()

bool Unit::isInvisible ( ) const

Definition at line 6230 of file Unit.cpp.

6231{
6233}
bool hasAuraWithAuraEffect(AuraEffect type) const
Definition Unit.cpp:5060
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isInWater()

bool Unit::isInWater ( ) const
virtual

Definition at line 1770 of file Unit.cpp.

1771{
1772 if (worldConfig.terrainCollision.isCollisionEnabled && getWorldMap())
1773 {
1775 }
1776
1777 return false;
1778}
@ LIQUID_MAP_UNDER_WATER
@ LIQUID_MAP_IN_WATER
@ MAP_ALL_LIQUIDS
ZLiquidStatus getLiquidStatus(uint32_t phaseMask, LocationVector pos, uint8_t ReqLiquidType, LiquidData *data=nullptr, float collisionHeight=2.03128f)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isLootable()

bool Unit::isLootable ( )

Definition at line 8174 of file Unit.cpp.

8175{
8176 if (isTagged() && !isPet() && !(isPlayer() && !IsInBg()) && (getCreatedByGuid() == 0) && !isVehicle())
8177 {
8178 if (const auto creatureProperties = sMySQLStore.getCreatureProperties(getEntry()))
8179 {
8180 if (isCreature() && !sLootMgr.isCreatureLootable(getEntry()) && creatureProperties->money == 0)
8181 return false;
8182 }
8183
8184 return true;
8185 }
8186
8187 return false;
8188}
#define sLootMgr
Definition LootMgr.hpp:106
bool IsInBg()
Definition Object.cpp:4412
virtual bool isVehicle() const
Definition Object.hpp:206
bool isTagged() const
Definition Unit.cpp:8125
uint64_t getCreatedByGuid() const
Definition Unit.cpp:397
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isMounted()

bool Unit::isMounted ( ) const

Definition at line 8541 of file Unit.cpp.

8542{
8543#if VERSION_STRING == Classic
8544 // TODO
8545 return false;
8546#else
8547 return hasUnitFlags(UNIT_FLAG_MOUNT);
8548#endif
8549}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isMoving()

bool Unit::isMoving ( ) const
inline

Definition at line 581 of file Unit.hpp.

◆ isPacified()

uint32_t Unit::isPacified ( ) const
inline

Definition at line 1348 of file Unit.hpp.

1348{ return m_pacified; }
int32_t m_pacified
Definition Unit.hpp:1349
Here is the caller graph for this function:

◆ isPoisoned()

bool Unit::isPoisoned ( )

Definition at line 5762 of file Unit.cpp.

5763{
5765 {
5766 const auto* aur = getAuraWithAuraSlot(x);
5767 if (aur && aur->getSpellInfo()->custom_c_is_flags & SPELL_FLAG_IS_POISON)
5768 return true;
5769 }
5770
5771 return false;
5772}
@ SPELL_FLAG_IS_POISON
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isPvpFlagSet()

bool Unit::isPvpFlagSet ( ) const
virtual

Reimplemented in Creature, and Player.

Definition at line 6940 of file Unit.cpp.

6940{ return false; }
Here is the caller graph for this function:

◆ isRooted()

bool Unit::isRooted ( ) const

Definition at line 1945 of file Unit.cpp.

1946{
1948}
@ MOVEFLAG_ROOTED
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isSanctuaryFlagSet()

bool Unit::isSanctuaryFlagSet ( ) const
virtual

Reimplemented in Creature, and Player.

Definition at line 6948 of file Unit.cpp.

6948{ return false; }
Here is the caller graph for this function:

◆ isSitting()

bool Unit::isSitting ( ) const

Definition at line 7054 of file Unit.cpp.

7055{
7056 const auto standState = getStandState();
7057 return
7058 standState == STANDSTATE_SIT_CHAIR || standState == STANDSTATE_SIT_LOW_CHAIR ||
7059 standState == STANDSTATE_SIT_MEDIUM_CHAIR || standState == STANDSTATE_SIT_HIGH_CHAIR ||
7060 standState == STANDSTATE_SIT;
7061}
@ STANDSTATE_SIT_MEDIUM_CHAIR
@ STANDSTATE_SIT_LOW_CHAIR
@ STANDSTATE_SIT_HIGH_CHAIR
@ STANDSTATE_SIT_CHAIR
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isSplineEnabled()

bool Unit::isSplineEnabled ( ) const

Definition at line 3292 of file Unit.cpp.

3293{
3294 return movespline->Initialized();
3295}

◆ isStealthed()

bool Unit::isStealthed ( ) const

Definition at line 6205 of file Unit.cpp.

6206{
6208}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isStunned()

uint32_t Unit::isStunned ( ) const
inline

Definition at line 1351 of file Unit.hpp.

1351{ return m_stunned; }
Here is the caller graph for this function:

◆ isTaggableFor()

bool Unit::isTaggableFor ( Unit const unit) const

Definition at line 8130 of file Unit.cpp.

8131{
8132 if (isPet())
8133 return false;
8134
8135 if (isTagged())
8136 {
8137 if (m_taggedBySummon && unit != nullptr)
8138 {
8139 // If tagged by summon, owner can tag it for themself
8140 for (const auto* summon : unit->getSummonInterface()->getSummons())
8141 {
8142 if (summon->getGuid() == m_taggerGuid)
8143 return true;
8144 }
8145 }
8146
8147 return false;
8148 }
8149
8150 return true;
8151}
bool m_taggedBySummon
Definition Unit.hpp:1208
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isTagged()

bool Unit::isTagged ( ) const

Definition at line 8125 of file Unit.cpp.

8126{
8128}
@ U_DYN_FLAG_TAGGED_BY_OTHER
bool hasDynamicFlags(uint16_t dynamicFlags) const
Definition Object.cpp:397
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isTaggedByPlayerOrItsGroup()

bool Unit::isTaggedByPlayerOrItsGroup ( Player tagger)

Definition at line 8153 of file Unit.cpp.

8154{
8155 if (!isTagged() || tagger == nullptr)
8156 return false;
8157
8158 if (getTaggerGuid() == tagger->getGuid())
8159 return true;
8160
8161 if (tagger->isInGroup())
8162 {
8163 if (const auto playerTagger = getWorldMapPlayer(getTaggerGuid()))
8164 if (tagger->getGroup()->HasMember(playerTagger))
8165 return true;
8166 }
8167
8168 return false;
8169}
bool HasMember(Player *pPlayer)
Definition Group.cpp:605
uint64_t getTaggerGuid() const
Definition Unit.cpp:8120
Here is the call graph for this function:

◆ isTrainingDummy()

virtual bool Unit::isTrainingDummy ( )
inlinevirtual

Reimplemented in Creature.

Definition at line 1079 of file Unit.hpp.

1079{ return false; }
Here is the caller graph for this function:

◆ isTurning()

bool Unit::isTurning ( ) const
inline

Definition at line 582 of file Unit.hpp.

◆ isUnderWater()

bool Unit::isUnderWater ( ) const

Definition at line 1780 of file Unit.cpp.

1781{
1782 if (worldConfig.terrainCollision.isCollisionEnabled && getWorldMap())
1783 {
1785 }
1786
1787 return false;
1788}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isUnitOwnerInParty()

bool Unit::isUnitOwnerInParty ( Unit unit)

Definition at line 7955 of file Unit.cpp.

7956{
7957 if (unit)
7958 {
7959 Player* playOwner = getPlayerOwnerOrSelf();
7960 Player* playerOwnerFromUnit = unit->getPlayerOwnerOrSelf();
7961 if (playOwner == nullptr || playerOwnerFromUnit == nullptr)
7962 return false;
7963
7964 if (playOwner == playerOwnerFromUnit)
7965 return true;
7966
7967 if (playOwner->getGroup()
7968 && playerOwnerFromUnit->getGroup()
7969 && playOwner->getGroup() == playerOwnerFromUnit->getGroup()
7970 && playOwner->getSubGroupSlot() == playerOwnerFromUnit->getSubGroupSlot())
7971 return true;
7972 }
7973
7974 return false;
7975}
int8_t getSubGroupSlot() const
Definition Player.cpp:7898
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isUnitOwnerInRaid()

bool Unit::isUnitOwnerInRaid ( Unit unit)

Definition at line 7977 of file Unit.cpp.

7978{
7979 if (unit)
7980 {
7981 Player* playerOwner = getPlayerOwnerOrSelf();
7982 Player* playerOwnerFromUnit = unit->getPlayerOwnerOrSelf();
7983 if (playerOwner == nullptr || playerOwnerFromUnit == nullptr)
7984 return false;
7985
7986 if (playerOwner == playerOwnerFromUnit)
7987 return true;
7988
7989 if (playerOwner->getGroup()
7990 && playerOwnerFromUnit->getGroup()
7991 && playerOwner->getGroup() == playerOwnerFromUnit->getGroup())
7992 return true;
7993 }
7994
7995 return false;
7996}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isWalking()

bool Unit::isWalking ( ) const
inline

Definition at line 586 of file Unit.hpp.

Here is the caller graph for this function:

◆ isWithinCombatRange()

bool Unit::isWithinCombatRange ( Unit obj,
float  dist2compare 
)

Definition at line 1728 of file Unit.cpp.

1729{
1730 if (!obj || !IsInMap(obj) || !(GetPhase() == obj->GetPhase()))
1731 return false;
1732
1733 float dx = GetPositionX() - obj->GetPositionX();
1734 float dy = GetPositionY() - obj->GetPositionY();
1735 float dz = GetPositionZ() - obj->GetPositionZ();
1736 float distsq = dx * dx + dy * dy + dz * dz;
1737
1738 float sizefactor = getCombatReach() + obj->getCombatReach();
1739 float maxdist = dist2compare + sizefactor;
1740
1741 return distsq < maxdist* maxdist;
1742}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isWithinMeleeRange()

bool Unit::isWithinMeleeRange ( Unit obj)
inline

Definition at line 534 of file Unit.hpp.

534{ return isWithinMeleeRangeAt(GetPosition(), obj); }
bool isWithinMeleeRangeAt(LocationVector const &pos, Unit *obj)
Definition Unit.cpp:1744

◆ isWithinMeleeRangeAt()

bool Unit::isWithinMeleeRangeAt ( LocationVector const pos,
Unit obj 
)

Definition at line 1744 of file Unit.cpp.

1745{
1746 if (!obj || !IsInMap(obj) || !(GetPhase() == obj->GetPhase()))
1747 return false;
1748
1749 float dx = pos.getPositionX() - obj->GetPositionX();
1750 float dy = pos.getPositionY() - obj->GetPositionY();
1751 float dz = pos.getPositionZ() - obj->GetPositionZ();
1752 float distsq = dx * dx + dy * dy + dz * dz;
1753
1754 float maxdist = getMeleeRange(obj);
1755
1756 return distsq <= maxdist * maxdist;
1757}
float getMeleeRange(Unit *target)
Definition Unit.cpp:1759
Here is the call graph for this function:

◆ jumpTo() [1/2]

void Unit::jumpTo ( float  speedXY,
float  speedZ,
bool  forward = true,
Optional< LocationVector dest = {} 
)

Definition at line 3297 of file Unit.cpp.

3298{
3299 float angle = forward ? 0 : static_cast<float>(M_PI);
3300 if (dest)
3301 angle += getRelativeAngle(*dest);
3302
3303 if (isCreature())
3304 {
3305 getMovementManager()->moveJumpTo(angle, speedXY, speedZ);
3306 }
3307 else
3308 {
3309 const float vcos = std::cos(angle + GetOrientation());
3310 const float vsin = std::sin(angle + GetOrientation());
3311
3312 WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8 + 4 + 4 + 4 + 4 + 4));
3313 data << GetNewGUID();
3314 data << uint32_t(0); // Sequence
3315 data << vcos << vsin;
3316 data << float(speedXY); // Horizontal speed
3317 data << float(-speedZ); // Z Movement speed (vertical)
3318
3319 ToPlayer()->sendPacket(&data);
3320 }
3321}
@ SMSG_MOVE_KNOCK_BACK
Definition Opcodes.hpp:286
void moveJumpTo(float angle, float speedXY, float speedZ)
float getRelativeAngle(Object const *obj)
Definition Object.hpp:526
void sendPacket(WorldPacket *packet) override
Definition Player.cpp:3161
Here is the call graph for this function:
Here is the caller graph for this function:

◆ jumpTo() [2/2]

void Unit::jumpTo ( Object obj,
float  speedZ,
bool  withOrientation = false 
)

Definition at line 3323 of file Unit.cpp.

3324{
3325 float x, y, z;
3326 obj->getNearPoint(this, x, y, z, 0.5f, getAbsoluteAngle(obj->GetPosition()));
3327 float speedXY = getExactDist2d(x, y) * 10.0f / speedZ;
3328 getMovementManager()->moveJump(x, y, z, getAbsoluteAngle(obj), speedXY, speedZ, EVENT_JUMP, withOrientation);
3329}
@ EVENT_JUMP
void moveJump(LocationVector const &pos, float speedXY, float speedZ, uint32_t id=EVENT_JUMP, bool hasOrientation=false)
float getAbsoluteAngle(float x, float y) const
Definition Object.hpp:513
float getExactDist2d(const float x, const float y) const
Definition Object.hpp:411
void getNearPoint(Object *searcher, float &x, float &y, float &z, float distance2d, float absAngle)
Definition Object.cpp:4773
Here is the call graph for this function:

◆ justDied()

bool Unit::justDied ( ) const

Definition at line 7873 of file Unit.cpp.

7873{ return m_deathState == JUST_DIED; }
@ JUST_DIED
Here is the caller graph for this function:

◆ knockbackFrom()

void Unit::knockbackFrom ( float  x,
float  y,
float  speedXY,
float  speedZ 
)

Definition at line 7636 of file Unit.cpp.

7637{
7638 Player* player = ToPlayer();
7639 if (!player)
7640 {
7641 if (getCharmGuid())
7642 {
7643 Unit* charmer = getWorldMapPlayer(getCharmGuid());
7644 player = charmer->ToPlayer();
7645 }
7646 }
7647
7648 if (!player)
7649 {
7650 getMovementManager()->moveKnockbackFrom(x, y, speedXY, speedZ);
7651 }
7652 else
7653 {
7654 player->getSession()->SendPacket(SmsgMoveKnockBack(player->GetNewGUID(), Util::getMSTime(), cosf(player->GetOrientation()), sinf(player->GetOrientation()), speedXY, -speedZ).serialise().get());
7655
7656#if VERSION_STRING >= TBC
7658 player->setMoveCanFly(true);
7659#endif
7660 }
7661}
@ SPELL_AURA_FLY
@ SPELL_AURA_ENABLE_FLIGHT2
WorldSession * getSession() const
Definition Player.cpp:3131
void setMoveCanFly(bool set_fly)
Definition Unit.cpp:2175
void SendPacket(WorldPacket *packet)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modAttackPowerMods()

void Unit::modAttackPowerMods ( int32_t  modifier)

Definition at line 1643 of file Unit.cpp.

1644{
1645#if VERSION_STRING < Cata
1646 int32_t currentModifier = getAttackPowerMods();
1647 currentModifier += modifier;
1648 setAttackPowerMods(currentModifier);
1649#else
1650 if (modifier == 0) { return; }
1651#endif
1652}
void setAttackPowerMods(int32_t modifier)
Definition Unit.cpp:1633
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modAttackPowerMultiplier()

void Unit::modAttackPowerMultiplier ( float  multiplier)

Definition at line 1656 of file Unit.cpp.

1657{
1658 float currentMultiplier = getAttackPowerMultiplier();
1659 currentMultiplier += multiplier;
1660 setAttackPowerMultiplier(currentMultiplier);
1661}
void setAttackPowerMultiplier(float multiplier)
Definition Unit.cpp:1655
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modAttackSpeedModifier()

void Unit::modAttackSpeedModifier ( WeaponDamageType  type,
int32_t  amount 
)

Definition at line 6922 of file Unit.cpp.

6923{
6924 if (amount > 0)
6925 m_attackSpeed[type] *= 1.0f + amount / 100.0f;
6926 else
6927 m_attackSpeed[type] /= 1.0f + -amount / 100.0f;
6928}
Here is the caller graph for this function:

◆ modBaseAttackTime()

void Unit::modBaseAttackTime ( uint8_t  slot,
int32_t  modTime 
)

Definition at line 1235 of file Unit.cpp.

1236{
1237 int32_t newAttackTime = getBaseAttackTime(slot);
1238 newAttackTime += modTime;
1239
1240 if (newAttackTime < 0)
1241 newAttackTime = 0;
1242
1243 setBaseAttackTime(slot, newAttackTime);
1244}
void setBaseAttackTime(uint8_t slot, uint32_t time)
Definition Unit.cpp:1234
Here is the call graph for this function:

◆ modGeneratedThreatModifyer()

void Unit::modGeneratedThreatModifyer ( uint32_t  school,
int32_t  mod 
)
inline

Definition at line 1201 of file Unit.hpp.

1201{ m_generatedThreatModifyer[school] += mod; }
Here is the caller graph for this function:

◆ modHealth()

void Unit::modHealth ( int32_t  health)

Definition at line 502 of file Unit.cpp.

503{
504 int32_t newHealth = getHealth();
505 newHealth += health;
506
507 if (newHealth < 0)
508 newHealth = 0;
509
510 setHealth(newHealth);
511}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modInvisibilityDetection()

void Unit::modInvisibilityDetection ( InvisibilityFlag  flag,
const int32_t  amount 
)

Definition at line 6225 of file Unit.cpp.

6226{
6227 m_invisibilityDetection[flag] += amount;
6228}
Here is the caller graph for this function:

◆ modInvisibilityLevel()

void Unit::modInvisibilityLevel ( InvisibilityFlag  flag,
const int32_t  amount 
)

Definition at line 6220 of file Unit.cpp.

6221{
6222 m_invisibilityLevel[flag] += amount;
6223}
Here is the caller graph for this function:

◆ modMaxHealth()

void Unit::modMaxHealth ( int32_t  maxHealth)

Definition at line 643 of file Unit.cpp.

644{
645 int32_t newMaxHealth = getMaxHealth();
646 newMaxHealth += maxHealth;
647
648 if (newMaxHealth < 0)
649 newMaxHealth = 0;
650
651 setMaxHealth(newMaxHealth);
652}
void setMaxHealth(uint32_t maxHealth)
Definition Unit.cpp:626
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modMaxPower()

void Unit::modMaxPower ( PowerType  type,
int32_t  value 
)

Definition at line 739 of file Unit.cpp.

740{
741 int32_t newValue = getMaxPower(type);
742 newValue += value;
743
744 if (newValue < 0)
745 newValue = 0;
746
747 setMaxPower(type, newValue);
748}
void setMaxPower(PowerType type, uint32_t value)
Definition Unit.cpp:685
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modModCastSpeed()

void Unit::modModCastSpeed ( float  modifier)

Definition at line 1423 of file Unit.cpp.

1424{
1425 float currentMod = getModCastSpeed();
1426 currentMod += modifier;
1427 setModCastSpeed(currentMod);
1428}
float getModCastSpeed() const
Definition Unit.cpp:1421
void setModCastSpeed(float modifier)
Definition Unit.cpp:1422
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modPower()

void Unit::modPower ( PowerType  type,
int32_t  value 
)

Definition at line 614 of file Unit.cpp.

615{
616 int32_t newPower = getPower(type);
617 newPower += value;
618
619 if (newPower < 0)
620 newPower = 0;
621
622 setPower(type, newPower);
623}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modPowerCostModifier()

void Unit::modPowerCostModifier ( uint16_t  school,
int32_t  modifier 
)

Definition at line 1604 of file Unit.cpp.

1605{
1606 int32_t currentModifier = getPowerCostModifier(school);
1607 currentModifier += modifier;
1608
1609 if (currentModifier < 0)
1610 currentModifier = 0;
1611
1612 setPowerCostModifier(school, currentModifier);
1613}
void setPowerCostModifier(uint16_t school, uint32_t modifier)
Definition Unit.cpp:1603
uint32_t getPowerCostModifier(uint16_t school) const
Definition Unit.cpp:1602
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modPowerCostMultiplier()

void Unit::modPowerCostMultiplier ( uint16_t  school,
float  multiplier 
)

Definition at line 1617 of file Unit.cpp.

1618{
1619 float currentMultiplier = getPowerCostMultiplier(school);
1620 currentMultiplier += multiplier;
1621 setPowerCostMultiplier(school, currentMultiplier);
1622}
float getPowerCostMultiplier(uint16_t school) const
Definition Unit.cpp:1615
void setPowerCostMultiplier(uint16_t school, float multiplier)
Definition Unit.cpp:1616
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modRangedAttackPowerMods()

void Unit::modRangedAttackPowerMods ( int32_t  modifier)

Definition at line 1682 of file Unit.cpp.

1683{
1684#if VERSION_STRING < Cata
1685 int32_t currentModifier = getRangedAttackPowerMods();
1686 currentModifier += modifier;
1687 setRangedAttackPowerMods(currentModifier);
1688#else
1689 if (modifier == 0) { return; }
1690#endif
1691}
void setRangedAttackPowerMods(int32_t modifier)
Definition Unit.cpp:1672
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modRangedAttackPowerMultiplier()

void Unit::modRangedAttackPowerMultiplier ( float  multiplier)

Definition at line 1695 of file Unit.cpp.

1696{
1697 float currentMultiplier = getRangedAttackPowerMultiplier();
1698 currentMultiplier += multiplier;
1699 setRangedAttackPowerMultiplier(currentMultiplier);
1700}
void setRangedAttackPowerMultiplier(float multiplier)
Definition Unit.cpp:1694
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modStealthDetection()

void Unit::modStealthDetection ( StealthFlag  flag,
const int32_t  amount 
)

Definition at line 6200 of file Unit.cpp.

6201{
6202 m_stealthDetection[flag] += amount;
6203}
Here is the caller graph for this function:

◆ modStealthLevel()

void Unit::modStealthLevel ( StealthFlag  flag,
const int32_t  amount 
)

Definition at line 6195 of file Unit.cpp.

6196{
6197 m_stealthLevel[flag] += amount;
6198}
Here is the caller graph for this function:

◆ modThreatModifyer()

void Unit::modThreatModifyer ( int32_t  mod)
inline

Definition at line 1198 of file Unit.hpp.

1198{ m_threatModifyer += mod; }
Here is the caller graph for this function:

◆ mount()

void Unit::mount ( uint32_t  mount,
uint32_t  vehicleId = 0,
uint32_t  creatureEntry = 0 
)

Definition at line 8551 of file Unit.cpp.

8552{
8553#if VERSION_STRING == Classic
8554 // TODO
8555#else
8556 if (mount)
8558
8559 addUnitFlags(UNIT_FLAG_MOUNT);
8560
8561 if (Player* player = ToPlayer())
8562 {
8563#if VERSION_STRING > TBC
8564 // mount as a vehicle
8565 if (VehicleId)
8566 {
8567 if (createVehicleKit(VehicleId, creatureEntry))
8568 {
8569 // Send others that we now have a vehicle
8570 sendMessageToSet(SmsgPlayerVehicleData(WoWGuid(getGuid()), VehicleId).serialise().get(), true);
8571 sendPacket(SmsgControlVehicle().serialise().get());
8572
8573 // mounts can also have accessories
8574 getVehicleKit()->initialize();
8575 getVehicleKit()->loadAllAccessories(false);
8576 }
8577 }
8578#endif
8579 // unsummon pet
8580 if (player->isPetRequiringTemporaryUnsummon())
8581 player->unSummonPetTemporarily();
8582
8583 // if we have charmed npc, stun him also (everywhere)
8584 if (Unit* charm = getWorldMapUnit(getCharmGuid()))
8585 if (charm->isCreature())
8586 charm->addUnitFlags(UNIT_FLAG_STUNNED);
8587
8588 ByteBuffer guidData;
8589 guidData << GetNewGUID();
8590
8591 WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, guidData.size() + 4 + 4);
8592 data.append(guidData);
8593 data << uint32_t(Util::getTimeNow()); // Packet counter
8594 data << getCollisionHeight();
8595 sendPacket(&data);
8596 }
8597
8599#endif
8600}
@ AURA_INTERRUPT_ON_MOUNT
void addUnitFlags(uint32_t unitFlags)
Definition Unit.cpp:1109
void mount(uint32_t mount, uint32_t vehicleId=0, uint32_t creatureEntry=0)
Definition Unit.cpp:8551
Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPushToWorld()

void Unit::OnPushToWorld ( )
virtual

Reimplemented from Object.

Reimplemented in Creature, Pet, Summon, TotemSummon, and Player.

Definition at line 353 of file Unit.cpp.

354{
355 for (const auto& aura : getAuraList())
356 {
357 if (aura != nullptr)
358 aura->RelocateEvents();
359 }
360
361#if VERSION_STRING >= WotLK
362 if (isVehicle() && getVehicleKit())
363 {
364 getVehicleKit()->initialize();
365 getVehicleKit()->loadAllAccessories(false);
366 }
367
368 m_zAxisPosition = 0.0f;
369#endif
370
372}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ onRemoveInRangeObject()

void Unit::onRemoveInRangeObject ( Object pObj)
virtual

Reimplemented from Object.

Reimplemented in Summon, Player, and Creature.

Definition at line 7573 of file Unit.cpp.

7574{
7577
7578 if (pObj->isCreatureOrPlayer())
7579 {
7580 if (getCharmGuid() == pObj->getGuid())
7582 }
7583}
void removeObjectFromInRangeSameFactionSet(Object *obj)
Definition Object.cpp:1739
void interruptSpell(uint32_t spellId=0, bool checkMeleeSpell=true)
Definition Object.cpp:701
void removeObjectFromInRangeOppositeFactionSet(Object *obj)
Definition Object.cpp:1679
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pauseMovement()

void Unit::pauseMovement ( uint32_t  timer = 0,
uint8_t  slot = 0,
bool  forced = true 
)

Definition at line 3013 of file Unit.cpp.

3014{
3015 if (isInvalidMovementSlot(slot))
3016 return;
3017
3018 if (MovementGenerator* movementGenerator = getMovementManager()->getCurrentMovementGenerator(MovementSlot(slot)))
3019 movementGenerator->pause(timer);
3020
3021 if (forced && getMovementManager()->getCurrentSlot() == MovementSlot(slot))
3022 stopMoving();
3023}
MovementSlot
bool isInvalidMovementSlot(uint8_t const slot)
void stopMoving()
Definition Unit.cpp:2998
Here is the call graph for this function:
Here is the caller graph for this function:

◆ playSpellVisual()

void Unit::playSpellVisual ( uint32_t  visual_id,
uint32_t  type 
)

Definition at line 3442 of file Unit.cpp.

3443{
3444 sendMessageToSet(SmsgPlaySpellVisual(getGuid(), visual_id, type).serialise().get(), true);
3445}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ possess()

void Unit::possess ( Unit unitTarget,
uint32_t  delay = 0 
)

Definition at line 8946 of file Unit.cpp.

8947{
8948 Player* playerController;
8949 if (isPlayer())
8950 playerController = dynamic_cast<Player*>(this);
8951 else // do not support creatures just yet
8952 return;
8953
8954 if (!playerController)
8955 return;
8956
8957 if (getCharmGuid())
8958 return;
8959
8960 setMoveRoot(true);
8961
8962 if (delay != 0)
8963 {
8964 sEventMgr.AddEvent(this, &Unit::possess, unitTarget, static_cast<uint32_t>(0), 0, delay, 1, 0);
8965 return;
8966 }
8967 if (unitTarget == nullptr)
8968 {
8969 setMoveRoot(false);
8970 return;
8971 }
8972
8973 playerController->setCharmGuid(unitTarget->getGuid());
8974 if (unitTarget->isCreature())
8975 {
8976 unitTarget->setAItoUse(false);
8977 unitTarget->stopMoving();
8978 unitTarget->m_redirectSpellPackets = playerController;
8979 unitTarget->m_playerControler = playerController;
8980 }
8981
8982 m_noInterrupt++;
8983
8984 setCharmGuid(unitTarget->getGuid());
8985 unitTarget->setCharmedByGuid(getGuid());
8986 unitTarget->setCharmTempVal(unitTarget->getFactionTemplate());
8987
8988 playerController->setFarsightGuid(unitTarget->getGuid());
8989 playerController->m_controledUnit = unitTarget;
8990
8991 unitTarget->setFaction(getFactionTemplate());
8993
8995
8996 playerController->sendClientControlPacket(unitTarget, 1);
8997
8998 unitTarget->updateInRangeOppositeFactionSet();
8999
9000 if (!(unitTarget->isPet() && dynamic_cast<Pet*>(unitTarget) == playerController->getPet()))
9001 {
9002 if (auto* creatureTarget = unitTarget->ToCreature())
9003 creatureTarget->sendSpellsToController(playerController, 0);
9004 }
9005}
@ UNIT_FLAG_LOCK_PLAYER
void updateInRangeOppositeFactionSet()
Definition Object.cpp:1640
void setFarsightGuid(uint64_t farsightGuid)
Definition Player.cpp:976
void sendClientControlPacket(Unit *target, uint8_t allowMove)
Definition Player.cpp:9732
Player * m_playerControler
Definition Unit.hpp:695
void possess(Unit *unitTarget, uint32_t delay=0)
Definition Unit.cpp:8946
void setCharmTempVal(uint32_t val)
Definition Unit.hpp:1484
void setCharmGuid(uint64_t guid)
Definition Unit.cpp:381
void setFaction(uint32_t factionId)
Definition Unit.hpp:261
uint32_t getFactionTemplate() const
Definition Unit.cpp:957
void setCharmedByGuid(uint64_t guid)
Definition Unit.cpp:392
Unit * m_controledUnit
Definition Unit.hpp:694
void setAItoUse(bool value)
Definition Unit.hpp:707
Player * m_redirectSpellPackets
Definition Unit.hpp:1502
Here is the call graph for this function:
Here is the caller graph for this function:

◆ propagateSpeedChange()

void Unit::propagateSpeedChange ( )

Definition at line 2903 of file Unit.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ regenerateHealthAndPowers()

void Unit::regenerateHealthAndPowers ( uint16_t  timePassed)

Definition at line 6358 of file Unit.cpp.

6359{
6360 if (!isAlive())
6361 return;
6362
6363 // Health
6364 m_healthRegenerateTimer += timePassed;
6367 {
6368 if (isPlayer())
6369 {
6370 dynamic_cast<Player*>(this)->regenerateHealth(getCombatHandler().isInCombat());
6372 }
6373 else
6374 {
6377 return;
6378
6379 dynamic_cast<Creature*>(this)->RegenerateHealth();
6380 }
6381 }
6382
6383#if VERSION_STRING < WotLK
6384 // Mana and Energy
6385 m_manaEnergyRegenerateTimer += timePassed;
6386 if (isPlayer())
6387 {
6388 if (m_manaEnergyRegenerateTimer >= REGENERATION_INTERVAL_MANA_ENERGY)
6389 {
6390 regeneratePower(POWER_TYPE_MANA, m_manaEnergyRegenerateTimer);
6391 regeneratePower(POWER_TYPE_ENERGY, m_manaEnergyRegenerateTimer);
6392 m_manaEnergyRegenerateTimer = 0;
6393 }
6394 }
6395 else
6396 {
6397 if (m_manaEnergyRegenerateTimer >= CREATURE_REGENERATION_INTERVAL_MANA_ENERGY)
6398 {
6400 {
6401 regeneratePower(POWER_TYPE_MANA, m_manaEnergyRegenerateTimer);
6402 regeneratePower(POWER_TYPE_ENERGY, m_manaEnergyRegenerateTimer);
6403 }
6404 m_manaEnergyRegenerateTimer = 0;
6405 }
6406 }
6407
6408 // Focus
6409 m_focusRegenerateTimer += timePassed;
6410 if (m_focusRegenerateTimer >= REGENERATION_INTERVAL_FOCUS)
6411 {
6412 regeneratePower(POWER_TYPE_FOCUS, m_focusRegenerateTimer);
6413 m_focusRegenerateTimer = 0;
6414 }
6415#else
6416 m_powerUpdatePacketTime += timePassed;
6417 m_powerRegenerateTimer += timePassed;
6418
6419 // Creatures that are not owned by players do not need to be updated in real time
6420 const auto updateInterval = getPlayerOwnerOrSelf() != nullptr
6423
6424 // Since wotlk most powers regenerate in real time
6425 if (m_powerRegenerateTimer >= updateInterval)
6426 {
6430 if (isPlayer())
6431 {
6434 }
6435
6439 }
6440#endif
6441
6442 // Update player only resources
6443 if (isPlayer())
6444 dynamic_cast<Player*>(this)->regeneratePlayerPowers(timePassed);
6445}
@ UNIT_NPC_FLAG_DISABLE_REGEN
@ UNIT_NPC_FLAG_DISABLE_PWREGEN
@ REGENERATION_INTERVAL_HEALTH
@ REGENERATION_INTERVAL_HEALTH_POLYMORPHED
@ REGENERATION_INTERVAL_POWER
@ UNIT_STATE_POLYMORPHED
Here is the call graph for this function:
Here is the caller graph for this function:

◆ regeneratePower()

void Unit::regeneratePower ( PowerType  type,
uint16_t  timePassed 
)

Definition at line 6447 of file Unit.cpp.

6448{
6449#if VERSION_STRING >= Cata
6451 return;
6452#endif
6453
6454 if (isCreature())
6455 {
6456 // Check for correct power type
6457 if (getPowerType() != type)
6458 return;
6459
6460 if (this->m_interruptRegen)
6461 return;
6462 }
6463
6464 const auto currentPower = getPower(type);
6465 const auto maxPower = getMaxPower(type);
6466 if (maxPower == 0)
6467 return;
6468
6469 float_t amount = 0.0f;
6470 auto sendUpdatePacket = false;
6471 switch (type)
6472 {
6473 case POWER_TYPE_MANA:
6474 {
6475 if (isPlayer())
6476 {
6477#if VERSION_STRING < Cata
6478 // Check for 5 second regen interruption
6479 if (isPowerRegenerationInterrupted())
6481 else
6483#else
6484 // Check for combat (5 second rule was removed in cata)
6487 else
6489#endif
6490#if VERSION_STRING < WotLK
6491 // Send update packet pre-wotlk
6492 sendUpdatePacket = true;
6493#endif
6494 }
6495 else
6496 {
6497 const auto manaRate = worldConfig.getFloatRate(isVehicle() ? RATE_VEHICLES_POWER_REGEN : RATE_POWER1);
6498 //\ todo: this creature mana regeneration is not correct, rewrite it
6500 {
6502 // Apply config rate for player owned creatures only
6503 if (getPlayerOwner() != nullptr)
6504 amount *= manaRate;
6505 }
6506 else
6507 {
6508 // 33% of total mana per tick when out of combat
6509 amount = maxPower * 0.33f;
6510 }
6511
6512 // Send update packet for creatures in all versions
6513#if VERSION_STRING >= WotLK
6514 // but not for player owned creatures after wotlk, they regen in real time
6515 if (getPlayerOwner() == nullptr)
6516#endif
6517 {
6518 sendUpdatePacket = true;
6519 }
6520 }
6521
6522 // Mana regeneration is calculated per 1 second
6523 // Convert it to correct amount for expansion / unit (i.e in wotlk 100ms for players and 2000ms for creatures)
6524 amount *= timePassed / 1000.0f;
6525 } break;
6526 case POWER_TYPE_RAGE:
6527#if VERSION_STRING >= WotLK
6529#endif
6530 {
6532 {
6534 }
6535 else
6536 {
6537 // Rage and Runic Power are lost at rate of 1.25 point per 1 second when out of combat
6538 amount = -12.5f;
6539 amount += getPowerRegeneration(type);
6540 }
6541
6542 // Convert it to correct amount for expansion (wotlk 100ms, pre wotlk 3000ms)
6543 amount *= timePassed / 1000.0f;
6544#if VERSION_STRING < WotLK
6545 sendUpdatePacket = true;
6546#endif
6547 } break;
6548 case POWER_TYPE_FOCUS:
6549 {
6550#if VERSION_STRING < WotLK
6551 // 24 focus per 4 seconds or 6 focus per 1 second according to WoWWiki
6552 amount = 6.0f;
6553 sendUpdatePacket = true;
6554#else
6555 // Focus regens 1 point per 200ms or 5 point per 1 second as of 3.0.2
6556 amount = 5.0f;
6557 // Do not send for players or player owned creatures after wotlk, they regen in real time
6558 if (getPlayerOwnerOrSelf() == nullptr)
6559 sendUpdatePacket = true;
6560#endif
6561 amount += getPowerRegeneration(type);
6562 // Convert it to correct amount for expansion (wotlk 100ms, pre wotlk 4000ms)
6563 amount *= timePassed / 1000.0f;
6564 } break;
6565 case POWER_TYPE_ENERGY:
6566 {
6567 // 10 energy per 1 second
6568 amount = 10.0f;
6569 amount += getPowerRegeneration(type);
6570
6571 // Send update packet for creatures in all versions
6572#if VERSION_STRING >= WotLK
6573 // but not for players or player owned creatures after wotlk, they regen in real time
6574 if (getPlayerOwnerOrSelf() == nullptr)
6575#endif
6576 {
6577 sendUpdatePacket = true;
6578 }
6579
6580 // Convert it to correct amount for expansion / unit (i.e in wotlk 100ms for players and 2000ms for creatures)
6581 amount *= timePassed / 1000.0f;
6582 } break;
6583#if VERSION_STRING >= Cata
6585 {
6587 return;
6588
6589 amount = -1.0f;
6590 } break;
6591#endif
6592 default:
6593 return;
6594 }
6595
6596 if (amount < 0.0f)
6597 {
6598 if (currentPower == 0)
6599 return;
6600 }
6601 else if (amount > 0.0f)
6602 {
6603 if (currentPower >= maxPower)
6604 return;
6605 }
6606 else
6607 {
6608 return;
6609 }
6610
6611 amount += m_powerFractions[type];
6612
6613 // Convert the float amount to integer and save the fraction for next power update
6614 // This fixes regen values like 0.98
6615 auto powerResult = currentPower;
6616 const auto integerAmount = static_cast<uint32_t>(std::fabs(amount));
6617
6618 if (amount < 0.0f)
6619 {
6620 if (currentPower > integerAmount)
6621 {
6622 powerResult -= integerAmount;
6623 m_powerFractions[type] = amount + integerAmount;
6624 }
6625 else
6626 {
6627 powerResult = 0;
6629 }
6630 }
6631 else
6632 {
6633 powerResult += integerAmount;
6634 if (powerResult > maxPower)
6635 {
6636 powerResult = maxPower;
6638 }
6639 else
6640 {
6641 m_powerFractions[type] = amount - integerAmount;
6642 }
6643 }
6644
6645#if VERSION_STRING < WotLK
6646 setPower(type, powerResult, sendUpdatePacket);
6647#else
6648 const auto updateObject = sendUpdatePacket || m_powerUpdatePacketTime >= REGENERATION_PACKET_UPDATE_INTERVAL || powerResult == maxPower || powerResult == 0;
6649 setPower(type, powerResult, sendUpdatePacket, !updateObject);
6650#endif
6651}
@ SPELL_AURA_MOD_POWER_REGEN_PERCENT
@ TOTAL_PLAYER_POWER_TYPES
Definition PowerType.hpp:38
@ RATE_VEHICLES_POWER_REGEN
Definition WorldConfig.h:42
@ RATE_POWER1
Definition WorldConfig.h:15
void updateObject()
Definition Object.cpp:412
bool isInCombat() const
Definition Unit.hpp:289
float getPowerRegenerationWhileInterrupted(PowerType type) const
Definition Unit.cpp:843
float_t m_powerFractions[TOTAL_PLAYER_POWER_TYPES]
Definition Unit.hpp:970
int32_t m_interruptRegen
Definition Unit.hpp:1463
float getPowerRegeneration(PowerType type) const
Definition Unit.cpp:750
float_t getTotalPctMultiplierForAuraEffectByMiscValue(AuraEffect aura_effect, int32_t miscValue) const
Definition Unit.cpp:4999
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAllAreaAurasCastedByOther()

void Unit::removeAllAreaAurasCastedByOther ( )

Definition at line 5545 of file Unit.cpp.

5546{
5548 {
5549 auto* const aur = getAuraWithAuraSlot(i);
5550 if (aur == nullptr)
5551 continue;
5552
5553 // Not area aura, or is area aura casted by this unit
5554 if (!aur->m_areaAura)
5555 continue;
5556
5557 aur->removeAura();
5558 }
5559}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAllAuras()

void Unit::removeAllAuras ( )

Definition at line 5239 of file Unit.cpp.

5240{
5242 {
5243 if (auto* const aur = getAuraWithAuraSlot(i))
5244 aur->removeAura();
5245 }
5246}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAllAurasByAuraEffect()

void Unit::removeAllAurasByAuraEffect ( AuraEffect  effect,
uint32_t  skipSpell = 0,
bool  removeOnlyEffect = false,
uint64_t  casterGuid = 0,
AuraRemoveMode  mode = AURA_REMOVE_BY_SERVER 
)

Definition at line 5306 of file Unit.cpp.

5307{
5308 if (!hasAuraWithAuraEffect(effect))
5309 return;
5310
5311 const auto& aurEffList = getAuraEffectList(effect);
5312 for (auto itr = aurEffList.cbegin(); itr != aurEffList.cend();)
5313 {
5314 const auto aurEff = *itr;
5315 auto* const aur = aurEff->getAura();
5316 ++itr;
5317
5318 if (skipSpell == aur->getSpellId())
5319 continue;
5320
5321 if (casterGuid != 0 && aur->getCasterGuid() != casterGuid)
5322 continue;
5323
5324 if (removeOnlyEffect)
5325 aur->removeAuraEffect(aurEff->getEffectIndex());
5326 else
5327 aur->removeAura(mode);
5328 }
5329}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAllAurasByAuraInterruptFlag()

void Unit::removeAllAurasByAuraInterruptFlag ( uint32_t  auraInterruptFlag,
uint32_t  skipSpellId = 0 
)

Definition at line 5290 of file Unit.cpp.

5291{
5293 {
5294 auto* const aur = getAuraWithAuraSlot(i);
5295 if (aur == nullptr)
5296 continue;
5297
5298 if (skipSpellId != 0 && aur->getSpellId() == skipSpellId)
5299 continue;
5300
5301 if (aur->getSpellInfo()->getAuraInterruptFlags() & auraInterruptFlag)
5302 aur->removeAura();
5303 }
5304}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAllAurasById() [1/2]

void Unit::removeAllAurasById ( uint32_t  auraId,
AuraRemoveMode  mode = AURA_REMOVE_BY_SERVER 
)

Definition at line 5248 of file Unit.cpp.

5249{
5251 {
5252 auto* const aur = getAuraWithAuraSlot(i);
5253 if (aur && aur->getSpellId() == auraId)
5254 aur->removeAura(mode);
5255 }
5256}
Here is the call graph for this function:

◆ removeAllAurasById() [2/2]

void Unit::removeAllAurasById ( uint32_t const auraId,
AuraRemoveMode  mode = AURA_REMOVE_BY_SERVER 
)

Definition at line 5258 of file Unit.cpp.

5259{
5261 {
5262 auto* const aur = getAuraWithAuraSlot(i);
5263 if (aur == nullptr)
5264 continue;
5265
5266 for (int x = 0; auraId[x] != 0; ++x)
5267 {
5268 if (aur->getSpellId() == auraId[x])
5269 aur->removeAura(mode);
5270 }
5271 }
5272}
Here is the call graph for this function:

◆ removeAllAurasByIdForGuid()

void Unit::removeAllAurasByIdForGuid ( uint32_t  auraId,
uint64_t  guid,
AuraRemoveMode  mode = AURA_REMOVE_BY_SERVER 
)

Definition at line 5274 of file Unit.cpp.

5275{
5277 {
5278 auto* const aur = getAuraWithAuraSlot(i);
5279 if (aur == nullptr)
5280 continue;
5281
5282 if (guid != 0 && aur->getCasterGuid() != guid)
5283 continue;
5284
5285 if (aur->getSpellId() == auraId)
5286 aur->removeAura(mode);
5287 }
5288}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAllAurasByIdReturnCount()

uint32_t Unit::removeAllAurasByIdReturnCount ( uint32_t  auraId,
AuraRemoveMode  mode = AURA_REMOVE_BY_SERVER 
)

Definition at line 5471 of file Unit.cpp.

5472{
5473 uint32_t res = 0;
5475 {
5476 auto* const aur = getAuraWithAuraSlot(i);
5477 if (aur && aur->getSpellInfo()->getId() == auraId)
5478 {
5479 aur->removeAura(mode);
5480 ++res;
5481 }
5482 }
5483
5484 return res;
5485}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAllAurasBySchoolMask()

void Unit::removeAllAurasBySchoolMask ( SchoolMask  schoolMask,
bool  negativeOnly = true,
bool  isImmune = false 
)

Definition at line 5414 of file Unit.cpp.

5415{
5417 {
5418 auto* const aur = getAuraWithAuraSlot(i);
5419 if (aur == nullptr)
5420 continue;
5421
5422 if (negativeOnly && !aur->isNegative())
5423 continue;
5424
5425 if (!(aur->getSpellInfo()->getSchoolMask() & schoolMask))
5426 continue;
5427
5428 if (!isImmune && aur->getSpellInfo()->getAttributes() & ATTRIBUTES_IGNORE_INVULNERABILITY)
5429 aur->removeAura();
5430 }
5431}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAllAurasBySpellMechanic() [1/2]

void Unit::removeAllAurasBySpellMechanic ( SpellMechanic const mechanic,
bool  negativeOnly = true 
)

Definition at line 5361 of file Unit.cpp.

5362{
5365
5366 for (auto i = start; i < end; ++i)
5367 {
5368 auto* const aur = getAuraWithAuraSlot(i);
5369 if (aur == nullptr)
5370 continue;
5371
5372 for (int x = 0; mechanic[x] != MECHANIC_NONE; ++x)
5373 {
5374 if (aur->getSpellInfo()->getMechanicsType() == mechanic[x])
5375 {
5376 aur->removeAura();
5377 }
5378 else
5379 {
5380 for (uint8_t u = 0; u < MAX_SPELL_EFFECTS; ++u)
5381 {
5382 if (aur->getAuraEffect(u)->getAuraEffectType() == SPELL_AURA_NONE)
5383 continue;
5384
5385 // Remove only aura effect in this case
5386 if (aur->getSpellInfo()->getEffectMechanic(u) == mechanic[x])
5387 aur->removeAuraEffect(u);
5388 }
5389 }
5390 }
5391 }
5392}
@ MECHANIC_NONE
Here is the call graph for this function:

◆ removeAllAurasBySpellMechanic() [2/2]

void Unit::removeAllAurasBySpellMechanic ( SpellMechanic  mechanic,
bool  negativeOnly = true 
)

Definition at line 5331 of file Unit.cpp.

5332{
5335
5336 for (auto i = start; i < end; ++i)
5337 {
5338 auto* const aur = getAuraWithAuraSlot(i);
5339 if (aur == nullptr)
5340 continue;
5341
5342 if (aur->getSpellInfo()->getMechanicsType() == mechanic)
5343 {
5344 aur->removeAura();
5345 }
5346 else
5347 {
5348 for (uint8_t x = 0; x < MAX_SPELL_EFFECTS; ++x)
5349 {
5350 if (aur->getAuraEffect(x)->getAuraEffectType() == SPELL_AURA_NONE)
5351 continue;
5352
5353 // Remove only aura effect in this case
5354 if (aur->getSpellInfo()->getEffectMechanic(x) == mechanic)
5355 aur->removeAuraEffect(x);
5356 }
5357 }
5358 }
5359}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAllAurasBySpellType()

void Unit::removeAllAurasBySpellType ( SpellTypes  type,
uint64_t  casterGuid = 0,
uint32_t  skipSpellId = 0 
)

Definition at line 5394 of file Unit.cpp.

5395{
5396 const uint64_t sGuid = type >= SPELL_TYPE_BLESSING ? casterGuid : 0;
5398 {
5399 auto* const aur = getAuraWithAuraSlot(i);
5400 if (aur == nullptr)
5401 continue;
5402
5403 if (skipSpellId != 0 && aur->getSpellId() == skipSpellId)
5404 continue;
5405
5406 if (!(aur->getSpellInfo()->custom_BGR_one_buff_on_target & type))
5407 continue;
5408
5409 if (sGuid == 0 || aur->getCasterGuid() == sGuid)
5410 aur->removeAura();
5411 }
5412}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAllFollowers()

void Unit::removeAllFollowers ( )

Definition at line 2987 of file Unit.cpp.

2988{
2989 while (!m_followingMe.empty())
2990 (*m_followingMe.begin())->setTarget(nullptr);
2991}
Here is the caller graph for this function:

◆ removeAllGameObjects()

void Unit::removeAllGameObjects ( )

Definition at line 8779 of file Unit.cpp.

8780{
8781 // remove references to unit
8782 while (!m_gameObj.empty())
8783 {
8784 GameObjectList::iterator i = m_gameObj.begin();
8785 (*i)->setOwnerGuid(0);
8786 (*i)->setRespawnTime(0);
8787 (*i)->Delete();
8788 m_gameObj.erase(i);
8789 }
8790}

◆ removeAllNegativeAuras()

void Unit::removeAllNegativeAuras ( )

Definition at line 5433 of file Unit.cpp.

5434{
5436 {
5437 if (auto* const aur = getAuraWithAuraSlot(i))
5438 aur->removeAura();
5439 }
5440}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAllNonPersistentAuras()

void Unit::removeAllNonPersistentAuras ( )

Definition at line 5451 of file Unit.cpp.

5452{
5454 {
5455 auto* const aur = getAuraWithAuraSlot(i);
5456 if (aur && !aur->getSpellInfo()->isDeathPersistent())
5457 aur->removeAura();
5458 }
5459}
@ REMOVABLE_SLOT_START
Definition AuraSlots.hpp:48
@ REMOVABLE_SLOT_END
Definition AuraSlots.hpp:49
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAllPositiveAuras()

void Unit::removeAllPositiveAuras ( )

Definition at line 5442 of file Unit.cpp.

5443{
5445 {
5446 if (auto* const aur = getAuraWithAuraSlot(i))
5447 aur->removeAura();
5448 }
5449}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAuraByItemGuid()

void Unit::removeAuraByItemGuid ( uint32_t  auraId,
uint64_t  itemguid 
)

Definition at line 5461 of file Unit.cpp.

5462{
5464 {
5465 auto* const aur = getAuraWithAuraSlot(i);
5466 if (aur && aur->getSpellId() == auraId && aur->itemCasterGUID == itemGuid)
5467 aur->removeAura();
5468 }
5469}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAurasByHeal()

bool Unit::removeAurasByHeal ( )

Definition at line 9579 of file Unit.cpp.

9580{
9581 bool result = false;
9583 {
9584 if (auto* const aur = getAuraWithAuraSlot(x))
9585 {
9586 switch (aur->getSpellId())
9587 {
9588 // remove after heal
9589 case 35321:
9590 case 38363:
9591 case 39215:
9592 {
9593 aur->removeAura();
9594 result = true;
9595 }
9596 break;
9597 // remove when healed to 100%
9598 case 31956:
9599 case 38801:
9600 case 43093:
9601 {
9602 if (getHealth() == getMaxHealth())
9603 {
9604 aur->removeAura();
9605 result = true;
9606 }
9607 }
9608 break;
9609 // remove at p% health
9610 case 38772:
9611 {
9612 uint32_t p = aur->getSpellInfo()->getEffectBasePoints(1);
9613 if (getMaxHealth() * p <= getHealth() * 100)
9614 {
9615 aur->removeAura();
9616 result = true;
9617 }
9618 }
9619 break;
9620 }
9621 }
9622 }
9623
9624 return result;
9625}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAuraState()

void Unit::removeAuraState ( uint32_t  state)

Definition at line 1231 of file Unit.cpp.

1231{ setAuraState(getAuraState() & ~state); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAuraStateAndAuras()

void Unit::removeAuraStateAndAuras ( AuraState  state)

Definition at line 5168 of file Unit.cpp.

5169{
5170 if (getAuraState() & (1 << (state - 1)))
5171 {
5172 removeAuraState(static_cast<uint32_t>(1 << (state - 1)));
5173
5174 // Remove self-applied auras requiring this aurastate
5177 // Do not remove non-passive enrage effects
5178 if (state == AURASTATE_FLAG_ENRAGED)
5179 {
5180 startLimit = AuraSlots::PASSIVE_SLOT_START;
5181 endLimit = AuraSlots::PASSIVE_SLOT_END;
5182 }
5183
5184 for (auto i = startLimit; i < endLimit; ++i)
5185 {
5186 auto* const aur = getAuraWithAuraSlot(i);
5187 if (aur == nullptr)
5188 continue;
5189 if (aur->getCasterGuid() != getGuid())
5190 continue;
5191 if (aur->getSpellInfo()->getCasterAuraState() != static_cast<uint32_t>(state))
5192 continue;
5193
5194 aur->removeAura();
5195 }
5196 }
5197}
void removeAuraState(uint32_t state)
Definition Unit.cpp:1231
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeDiminishingReturnTimer()

void Unit::removeDiminishingReturnTimer ( SpellInfo const spell)

Definition at line 3494 of file Unit.cpp.

3495{
3496 uint32_t status = sSpellMgr.getDiminishingGroup(spell->getId());
3497 uint32_t group = status & 0xFFFF;
3498 uint32_t pve = (status >> 16) & 0xFFFF;
3499 uint32_t aura_group;
3500
3501 // Make sure we have a group
3502 if (group == 0xFFFF)
3503 {
3504 return;
3505 }
3506
3507 // Check if we don't apply to pve
3508 if (!pve && !isPlayer() && !isPet())
3509 {
3510 return;
3511 }
3512
3513 /*There are cases in which you just refresh an aura duration instead of the whole aura,
3514 causing corruption on the diminishAura counter and locking the entire diminishing group.
3515 So it's better to check the active auras one by one*/
3516 m_diminishAuraCount[group] = 0;
3518 {
3519 if (const auto* aur = getAuraWithAuraSlot(x))
3520 {
3521 aura_group = sSpellMgr.getDiminishingGroup(aur->getSpellInfo()->getId());
3522 if (aura_group == status)
3523 {
3524 m_diminishAuraCount[group]++;
3525 }
3526 }
3527 }
3528
3529 // Start timer decrease
3530 if (!m_diminishAuraCount[group])
3531 {
3532 m_diminishActive = true;
3533 m_diminishTimer[group] = 15000;
3534 }
3535}
uint16_t m_diminishTimer[DIMINISHING_GROUP_COUNT]
Definition Unit.hpp:1494
uint8_t m_diminishAuraCount[DIMINISHING_GROUP_COUNT]
Definition Unit.hpp:1493
bool m_diminishActive
Definition Unit.hpp:1495
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeExtraStrikeTarget()

void Unit::removeExtraStrikeTarget ( SpellInfo const spellInfo)

Definition at line 9227 of file Unit.cpp.

9228{
9229 for (auto extraStrikeTarget = m_extraStrikeTargets.begin(); extraStrikeTarget != m_extraStrikeTargets.end(); ++extraStrikeTarget)
9230 {
9231 if (spellInfo == (*extraStrikeTarget)->spell_info)
9232 {
9234 m_extraStrikeTargets.erase(extraStrikeTarget);
9235 break;
9236 }
9237 }
9238}
Here is the caller graph for this function:

◆ removeFfaPvpFlag()

void Unit::removeFfaPvpFlag ( )
virtual

Reimplemented in Creature, and Player.

Definition at line 6946 of file Unit.cpp.

6946{}

◆ RemoveFromWorld()

void Unit::RemoveFromWorld ( bool  free_guid)
virtual

Remove object from world.

Reimplemented from Object.

Reimplemented in Creature.

Definition at line 288 of file Unit.cpp.

289{
290#ifdef FT_VEHICLES
291 if (isVehicle())
292 removeVehicleKit();
293#endif
295
297
298#if VERSION_STRING > TBC
299 if (getCritterGuid() != 0)
300 {
301 setCritterGuid(0);
302
303 if (Unit* unit = m_WorldMap->getUnit(getCritterGuid()))
304 unit->Delete();
305 }
306#endif
307
308 m_summonInterface->removeAllSummons();
309
310 if (m_dynamicObject != nullptr)
312
313 for (unsigned int& m_ObjectSlot : m_objectSlots)
314 {
315 if (m_ObjectSlot != 0)
316 {
317 if (GameObject* game_object = m_WorldMap->getGameObject(m_ObjectSlot))
318 game_object->expireAndDelete();
319
320 m_ObjectSlot = 0;
321 }
322 }
323
326
327 // Attempt to prevent memory corruption
328 for (const auto& object : getInRangeObjectsSet())
329 {
330 if (!object->isCreatureOrPlayer())
331 continue;
332
333 dynamic_cast<Unit*>(object)->clearCasterFromHealthBatch(this);
334 }
335
336 Object::RemoveFromWorld(free_guid);
337
339 {
340 if (auto* const aura = getAuraWithAuraSlot(x))
341 {
342 if (aura->m_deleted)
343 {
344 m_auraList[x] = nullptr;
345 continue;
346 }
347 aura->RelocateEvents();
348 }
349 }
351}
void onRemoveFromWorld()
WorldMap * m_WorldMap
Definition Object.hpp:736
virtual void RemoveFromWorld(bool free_guid)
Remove object from world.
Definition Object.cpp:3524
DynamicObject * m_dynamicObject
Definition Unit.hpp:1497
uint32_t m_objectSlots[4]
Definition Unit.hpp:1086
void clearAllAreaAuraTargets()
Definition Unit.cpp:5532
void removeAllAreaAurasCastedByOther()
Definition Unit.cpp:5545
void clearCasterFromHealthBatch(Unit const *caster)
Definition Unit.cpp:7500
void removeAllFollowers()
Definition Unit.cpp:2987
GameObject * getGameObject(uint32_t guid)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeGameObject() [1/2]

void Unit::removeGameObject ( GameObject gameObj,
bool  del 
)

Definition at line 8720 of file Unit.cpp.

8721{
8722 if (!gameObj || gameObj->getCreatedByGuid() != getGuid())
8723 return;
8724
8725 if (isPlayer())
8726 ToPlayer()->setSummonedObject(nullptr);
8727
8728 gameObj->setOwnerGuid(0);
8729
8730 for (uint8_t i = 0; i < 4; ++i)
8731 {
8732 if (m_objectSlots[i] == gameObj->GetUIdFromGUID())
8733 {
8734 m_objectSlots[i] = 0;
8735 break;
8736 }
8737 }
8738
8739 // GO created by some spell
8740 if (uint32_t spellid = gameObj->getSpellId())
8741 removeAllAurasById(spellid);
8742
8743 m_gameObj.remove(gameObj);
8744
8745 if (del)
8746 {
8747 gameObj->setRespawnTime(0);
8748 gameObj->Delete();
8749 }
8750}
void setRespawnTime(int32_t respawn)
uint32_t getSpellId() const
Definition GameObject.h:85
void Delete()
Definition Object.hpp:682
uint32_t GetUIdFromGUID() const
Definition Object.hpp:338
void setSummonedObject(Object *summonedObject)
Definition Player.cpp:12705
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeGameObject() [2/2]

void Unit::removeGameObject ( uint32_t  spellId,
bool  del 
)

Definition at line 8752 of file Unit.cpp.

8753{
8754 if (m_gameObj.empty())
8755 return;
8756
8757 GameObjectList::iterator i, next;
8758 for (i = m_gameObj.begin(); i != m_gameObj.end(); i = next)
8759 {
8760 next = i;
8761 if (spellId == 0 || (*i)->getSpellId() == spellId)
8762 {
8763 (*i)->setOwnerGuid(0);
8764 if (del)
8765 {
8766 (*i)->setRespawnTime(0);
8767 (*i)->Delete();
8768 }
8769
8770 next = m_gameObj.erase(i);
8771 }
8772 else
8773 {
8774 ++next;
8775 }
8776 }
8777}
#define next(ls)
Definition llex.c:32

◆ removeGarbage()

void Unit::removeGarbage ( )

Definition at line 8926 of file Unit.cpp.

8927{
8928 for (auto pet : m_GarbagePets)
8929 delete pet;
8930
8931 m_GarbageAuras.clear();
8932 m_GarbagePets.clear();
8933}
Here is the caller graph for this function:

◆ removeNpcFlags()

void Unit::removeNpcFlags ( uint64_t  npcFlags)

Definition at line 1442 of file Unit.cpp.

1442{ setNpcFlags(getNpcFlags() & ~npcFlags); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removePetFlags()

void Unit::removePetFlags ( uint8_t  petFlags)

Definition at line 1583 of file Unit.cpp.

1583{ setPetFlags(getPetFlags() & ~petFlags); }
Here is the call graph for this function:

◆ removeProcTriggerSpell()

void Unit::removeProcTriggerSpell ( uint32_t  spellId,
uint64_t  casterGuid = 0,
uint64_t  misc = 0 
)

Definition at line 3773 of file Unit.cpp.

3774{
3775 for (auto& spellProc : m_procSpells)
3776 {
3777 if (sScriptMgr.callScriptedSpellProcCanDelete(spellProc.get(), spellId, casterGuid, misc))
3778 {
3779 spellProc->deleteProc();
3780 return;
3781 }
3782
3783 if (spellProc->canDeleteProc(spellId, casterGuid, misc))
3784 {
3785 spellProc->deleteProc();
3786 return;
3787 }
3788 }
3789}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removePvpFlag()

void Unit::removePvpFlag ( )
virtual

Reimplemented in Creature, and Player.

Definition at line 6942 of file Unit.cpp.

6942{}

◆ removeReflect()

void Unit::removeReflect ( uint32_t  spellId,
bool  apply 
)

Removes and deletes reflects from unit by spell id, does not remove aura which created it In specific cases reflects can be created by a dummy spelleffect (eg. spell 28332 or 13043), then we need to remove it in ~unit

Definition at line 9304 of file Unit.cpp.

9305{
9306 for (auto reflectSpellSchool = m_reflectSpellSchool.begin(); reflectSpellSchool != m_reflectSpellSchool.end();)
9307 {
9308 if (spellId == (*reflectSpellSchool)->spellId)
9309 {
9310 reflectSpellSchool = m_reflectSpellSchool.erase(reflectSpellSchool);
9311 }
9312 else
9313 {
9314 ++reflectSpellSchool;
9315 }
9316 }
9317
9318 if (apply && spellId == 23920 && isPlayer())
9319 {
9320 const uint32_t improvedSpellReflection[] =
9321 {
9322 //SPELL_HASH_IMPROVED_SPELL_REFLECTION
9323 59088,
9324 59089,
9325 0
9326 };
9327
9328 if (hasAurasWithId(improvedSpellReflection))
9329 {
9330 const auto player = dynamic_cast<Player*>(this);
9331 if (auto group = player->getGroup())
9332 {
9333 int32_t targets = 0;
9334 if (player->hasAurasWithId(59088))
9335 targets = 2;
9336 else if (player->hasAurasWithId(59089))
9337 targets = 4;
9338
9339 group->Lock();
9340 for (uint32_t subGroupNumber = 0; subGroupNumber < group->GetSubGroupCount(); ++subGroupNumber)
9341 {
9342 SubGroup* subGroup = group->GetSubGroup(subGroupNumber);
9343 for (auto subGroupMember : subGroup->getGroupMembers())
9344 {
9345 Player* member = sObjectMgr.getPlayer(subGroupMember->guid);
9346 if (member == nullptr || member == player || !member->IsInWorld() || !member->isAlive() || member->hasAurasWithId(59725))
9347 continue;
9348
9349 if (!member->isInRange(player, 20))
9350 continue;
9351
9352 player->castSpell(member, 59725, true);
9353 targets -= 1;
9354 }
9355 }
9356 group->Unlock();
9357 }
9358 }
9359 }
9360
9361 if (!apply && spellId == 59725 && isPlayer())
9362 {
9363 const auto player = dynamic_cast<Player*>(this);
9364 if (auto group = player->getGroup())
9365 {
9366 group->Lock();
9367 for (uint32_t subGroupNumber = 0; subGroupNumber < group->GetSubGroupCount(); ++subGroupNumber)
9368 {
9369 for (auto subgroupMember : group->GetSubGroup(subGroupNumber)->getGroupMembers())
9370 {
9371 Player* playerMember = sObjectMgr.getPlayer(subgroupMember->guid);
9372 if (playerMember == nullptr)
9373 continue;
9374
9375 playerMember->removeAllAurasById(59725);
9376 }
9377 }
9378 group->Unlock();
9379 }
9380 }
9381}
std::list< std::unique_ptr< ReflectSpellSchool > > m_reflectSpellSchool
Definition Unit.hpp:1280
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeSanctuaryFlag()

void Unit::removeSanctuaryFlag ( )
virtual

Reimplemented in Creature, and Player.

Definition at line 6950 of file Unit.cpp.

6950{}

◆ removeSingleTargetGuidForAura()

void Unit::removeSingleTargetGuidForAura ( uint32_t  spellId)

Definition at line 5524 of file Unit.cpp.

5525{
5526 auto itr = m_singleTargetAura.find(spellId);
5527
5528 if (itr != m_singleTargetAura.end())
5529 m_singleTargetAura.erase(itr);
5530}
Here is the caller graph for this function:

◆ removeStandStateFlags()

void Unit::removeStandStateFlags ( uint8_t  standStateFlags)

Definition at line 1393 of file Unit.cpp.

1393{ setStandStateFlags(getStandStateFlags() & ~standStateFlags); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeUnitFlags()

void Unit::removeUnitFlags ( uint32_t  unitFlags)

Definition at line 1110 of file Unit.cpp.

1110{ setUnitFlags(getUnitFlags() & ~unitFlags); }
Here is the call graph for this function:

◆ removeUnitMovementFlag()

void Unit::removeUnitMovementFlag ( uint32_t  f)

Definition at line 1936 of file Unit.cpp.

1936{ obj_movement_info.flags &= ~f; }
Here is the caller graph for this function:

◆ removeUnitStateFlag()

void Unit::removeUnitStateFlag ( uint32_t  state_flag)
inline

Definition at line 718 of file Unit.hpp.

718{ m_unitState &= ~state_flag; }
Here is the caller graph for this function:

◆ resetAttackTimer()

void Unit::resetAttackTimer ( WeaponDamageType  type)

Definition at line 6917 of file Unit.cpp.

6918{
6919 setAttackTimer(type, static_cast<uint32_t>(getBaseAttackTime(type) * m_attackSpeed[type]));
6920}
void setAttackTimer(WeaponDamageType type, uint32_t time)
Definition Unit.cpp:6902
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetAuraUpdateMaskForRaid()

void Unit::resetAuraUpdateMaskForRaid ( )
inline

Definition at line 1285 of file Unit.hpp.

1285{ m_auraRaidUpdateMask = 0; }

◆ resetCurrentSpeeds()

void Unit::resetCurrentSpeeds ( )

Definition at line 2898 of file Unit.cpp.

2899{
2900 for (uint8_t i = 0; i < MAX_SPEED_TYPE; ++i)
2902}
Here is the caller graph for this function:

◆ resetDisplayId()

void Unit::resetDisplayId ( )

Definition at line 1270 of file Unit.cpp.

1271{
1272 write(unitData()->display_id, unitData()->native_display_id);
1273}
bool write(const uint8_t &member, uint8_t val, bool skipObjectUpdate=false)
Definition Object.cpp:106
Here is the call graph for this function:
Here is the caller graph for this function:

◆ restoreDisplayId()

void Unit::restoreDisplayId ( )

Definition at line 6952 of file Unit.cpp.

6953{
6954 // Standard transform aura
6955 Aura* transform = nullptr;
6956 // Mostly a negative transform
6957 Aura* forcedTransform = nullptr;
6958
6959 const auto& transformAuraList = getAuraEffectList(SPELL_AURA_TRANSFORM);
6960 for (auto itr = transformAuraList.crbegin(); itr != transformAuraList.crend(); ++itr)
6961 {
6962 auto* const aur = (*itr)->getAura();
6963 if (transform == nullptr)
6964 transform = aur;
6965
6966 // Forced transform takes priority over other transforms
6967 const auto isForcedTransform = (aur->getSpellInfo()->getAttributes() & ATTRIBUTES_IGNORE_INVULNERABILITY && aur->getSpellInfo()->getAttributesEx() & ATTRIBUTESEX_NO_INITIAL_AGGRO) || aur->getSpellInfo()->getAttributesExC() & ATTRIBUTESEXC_HIGH_PRIORITY;
6968 if (isForcedTransform && forcedTransform == nullptr)
6969 forcedTransform = aur;
6970
6971#if VERSION_STRING == Classic
6972 // In Classic skeleton transforms (i.e. Noggenfogger Elixir) are considered forced transforms and they take priority over shapeshifting
6973 if (aur->getSpellInfo()->getAttributes() == 0x28000000)
6974 forcedTransform = aur;
6975#endif
6976
6977 // Negative aura has highest priority
6978 if (aur->isNegative())
6979 {
6980 forcedTransform = aur;
6981 break;
6982 }
6983 }
6984
6985 // Priority:
6986 // 1. negative transform
6987 // 2. forced transform (and skeleton transforms in Classic)
6988 // 3. shapeshift
6989 // 4. other transform
6990 // 5. native display id
6991 if (forcedTransform != nullptr)
6992 {
6993 // Get display id from aura
6994 for (uint8_t i = 0; i < MAX_SPELL_EFFECTS; ++i)
6995 {
6996 if (forcedTransform->getAuraEffect(i)->getAuraEffectType() != SPELL_AURA_TRANSFORM)
6997 continue;
6998
6999 const auto displayId = forcedTransform->getAuraEffect(i)->getEffectFixedDamage();
7000 if (displayId != 0)
7001 {
7002 setDisplayId(displayId);
7004 setTransformAura(forcedTransform->getSpellId());
7005 return;
7006 }
7007 }
7008 }
7009
7010 // There can be only one shapeshift aura
7011 const auto shapeshift = getAuraWithAuraEffect(SPELL_AURA_MOD_SHAPESHIFT);
7012 if (shapeshift != nullptr)
7013 {
7014 // Get display id from aura
7015 for (uint8_t i = 0; i < MAX_SPELL_EFFECTS; ++i)
7016 {
7017 if (shapeshift->getAuraEffect(i)->getAuraEffectType() != SPELL_AURA_MOD_SHAPESHIFT)
7018 continue;
7019
7020 const auto displayId = shapeshift->getAuraEffect(i)->getEffectFixedDamage();
7021 if (displayId != 0)
7022 {
7023 setDisplayId(displayId);
7025 return;
7026 }
7027 }
7028 }
7029
7030 if (transform != nullptr)
7031 {
7032 // Get display id from aura
7033 for (uint8_t i = 0; i < MAX_SPELL_EFFECTS; ++i)
7034 {
7036 continue;
7037
7038 const auto displayId = transform->getAuraEffect(i)->getEffectFixedDamage();
7039 if (displayId != 0)
7040 {
7041 setDisplayId(displayId);
7043 setTransformAura(transform->getSpellId());
7044 return;
7045 }
7046 }
7047 }
7048
7049 // No transform aura, no shapeshift aura => use native display id
7052}
@ SPELL_AURA_MOD_SHAPESHIFT
@ SPELL_AURA_TRANSFORM
@ ATTRIBUTESEX_NO_INITIAL_AGGRO
@ ATTRIBUTESEXC_HIGH_PRIORITY
AuraEffectModifier const * getAuraEffect(uint8_t effIndex) const
Definition SpellAura.cpp:26
uint32_t getAttributesExC() const
void setTransformAura(uint32_t auraId)
Definition Unit.cpp:5566
AuraEffect getAuraEffectType() const
int32_t getEffectFixedDamage() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resumeMovement()

void Unit::resumeMovement ( uint32_t  timer = 0,
uint8_t  slot = 0 
)

Definition at line 3025 of file Unit.cpp.

3026{
3027 if (isInvalidMovementSlot(slot))
3028 return;
3029
3030 if (MovementGenerator* movementGenerator = getMovementManager()->getCurrentMovementGenerator(MovementSlot(slot)))
3031 movementGenerator->resume(timer);
3032}
Here is the call graph for this function:

◆ sendAttackerStateUpdate()

void Unit::sendAttackerStateUpdate ( const WoWGuid attackerGuid,
const WoWGuid victimGuid,
HitStatus  hitStatus,
uint32_t  damage,
uint32_t  overKill,
DamageInfo  damageInfo,
uint32_t  absorbedDamage,
VisualState  visualState,
uint32_t  blockedDamage,
uint32_t  rageGain 
)

Definition at line 4355 of file Unit.cpp.

4356{
4357 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Status {}, damage {}", uint32_t(hitStatus), damage);
4358
4359 WorldPacket data(SMSG_ATTACKERSTATEUPDATE, (4 + 8 + 8 + 4) + 1 + (1 * (4 + 4 + 4 + 4 + 4)) + (4 + 4 + 4 + 4));
4360
4361 // School type in classic, school mask in tbc+
4362 uint32_t school;
4363#if VERSION_STRING == Classic
4364 school = damageInfo.getSchoolTypeFromMask();
4365#else
4366 school = damageInfo.schoolMask;
4367#endif
4368
4369 data << uint32_t(hitStatus);
4370 data << attackerGuid;
4371 data << victimGuid;
4372 data << uint32_t(damage); // real damage
4373
4374 data << uint8_t(1); // damage counter
4375
4376 data << uint32_t(school); // damage school
4377 data << float(damageInfo.fullDamage);
4378 data << uint32_t(damageInfo.fullDamage);
4379 data << uint32_t(absorbedDamage);
4380 data << int32_t(damageInfo.resistedDamage);
4381
4382 data << uint32_t(visualState);
4383 data << uint32_t(0);
4384 data << uint32_t(0);
4385
4386 data << uint32_t(blockedDamage);
4387
4388 if (hitStatus & HITSTATUS_UNK_00)
4389 {
4390 data << uint32_t(0);
4391 data << float(0);
4392 data << float(0);
4393 data << float(0);
4394 data << float(0);
4395 data << float(0);
4396 data << float(0);
4397 data << float(0);
4398 data << float(0);
4399 for (uint8_t i = 0; i < 5; ++i)
4400 {
4401 data << float(0);
4402 data << float(0);
4403 }
4404 data << uint32_t(0);
4405 }
4406
4407 sendMessageToSet(&data, true);
4408}
@ SMSG_ATTACKERSTATEUPDATE
Definition Opcodes.hpp:375
@ HITSTATUS_UNK_00
uint32_t resistedDamage
uint8_t getSchoolTypeFromMask() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendAuraUpdate()

void Unit::sendAuraUpdate ( Aura aur,
bool  remove 
)

Definition at line 5571 of file Unit.cpp.

5572{
5574 return;
5575
5576#if VERSION_STRING < WotLK
5577 if (!remove)
5578 {
5579#if VERSION_STRING == Classic
5580 if (isPlayer() && !aur->IsPassive())
5581 static_cast<Player*>(this)->sendMessageToSet(SmsgUpdateAuraDuration(aur->m_visualSlot, aur->getTimeLeft()).serialise().get(), true);
5582#else
5583
5585 {
5586 static_cast<Player*>(this)->sendMessageToSet(SmsgUpdateAuraDuration(aur->m_visualSlot, aur->getTimeLeft()).serialise().get(), true);
5587
5588 auto guid = GetNewGUID();
5589 static_cast<Player*>(this)->sendMessageToSet(SmsgSetExtraAuraInfo(guid, aur->m_visualSlot, aur->getSpellId(), aur->getMaxDuration(), aur->getTimeLeft()).serialise().get(), true);
5590 }
5591
5592 const auto caster = aur->GetUnitCaster();
5593 if (caster != nullptr && caster->isPlayer() && caster->getGuid() != getGuid())
5594 {
5596 data << GetNewGUID();
5597 data << uint8_t(aur->m_visualSlot);
5598 data << uint32_t(aur->getSpellId());
5599 data << uint32_t(aur->getMaxDuration());
5600 data << uint32_t(aur->getTimeLeft());
5601 caster->sendMessageToSet(&data, true);
5602 }
5603#endif
5604 }
5605#if VERSION_STRING == TBC
5606 else
5607 {
5608 const auto caster = aur->GetUnitCaster();
5609 if (caster != nullptr && caster->isPlayer())
5610 static_cast<Player*>(caster)->sendMessageToSet(SmsgClearExtraAuraInfo(getGuid(), aur->getSpellId()).serialise().get(), true);
5611 }
5612#endif
5613#else
5614 SmsgAuraUpdate::AuraUpdate auraUpdate;
5615
5616 auraUpdate.visualSlot = aur->m_visualSlot;
5617 auraUpdate.flags = aur->getAuraFlags();
5618 auraUpdate.spellId = aur->getSpellId();
5619
5620 const auto casterUnit = aur->GetUnitCaster();
5621 if (casterUnit != nullptr)
5622 auraUpdate.level = static_cast<uint8_t>(casterUnit->getLevel());
5623 else
5624 auraUpdate.level = static_cast<uint8_t>(worldConfig.player.playerLevelCap);
5625
5626 const uint32_t stackAmount = aur->getSpellInfo()->getMaxstack() > 0 ? aur->getStackCount() : aur->getCharges();
5627 auraUpdate.stackCount = static_cast<uint8_t>(stackAmount <= 255 ? stackAmount : 255);
5628
5629 if (!(auraUpdate.flags & AFLAG_IS_CASTER))
5630 auraUpdate.casterGuid = aur->getCasterGuid();
5631
5632 if (auraUpdate.flags & AFLAG_DURATION)
5633 {
5634 auraUpdate.duration = aur->getMaxDuration();
5635 auraUpdate.timeLeft = aur->getTimeLeft();
5636 }
5637
5638#if VERSION_STRING >= Cata
5639 if (auraUpdate.flags & AFLAG_SEND_EFFECT_AMOUNT)
5640 {
5641 for (uint8_t i = 0; i < MAX_SPELL_EFFECTS; ++i)
5642 {
5644 auraUpdate.effAmount[i] = aur->getAuraEffect(i)->getEffectDamage();
5645 else
5646 auraUpdate.effAmount[i] = 0;
5647 }
5648 }
5649#endif
5650
5651 sendMessageToSet(SmsgAuraUpdate(getGuid(), auraUpdate, remove).serialise().get(), true);
5652#endif
5653}
@ SMSG_SET_EXTRA_AURA_INFO_NEED_UPDATE
Definition Opcodes.hpp:1015
@ AFLAG_SEND_EFFECT_AMOUNT
@ AFLAG_IS_CASTER
@ AFLAG_DURATION
@ ATTRIBUTESEXE_HIDE_DURATION
int32_t getTimeLeft() const
uint64_t getCasterGuid() const
int32_t getMaxDuration() const
uint16_t getCharges() const
Unit * GetUnitCaster()
uint8_t m_visualSlot
uint8_t getAuraFlags() const
bool IsPassive() const
uint32_t getMaxstack() const
uint32_t getAttributesExE() const
int32_t getEffectDamage() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendChatMessage() [1/3]

void Unit::sendChatMessage ( MySQLStructure::NpcScriptText const text,
uint32_t  delay,
Unit target = nullptr 
)

Definition at line 6868 of file Unit.cpp.

6869{
6870 if (!isCreature() || text == nullptr)
6871 return;
6872
6873 if (delay > 0)
6874 {
6876 return;
6877 }
6878
6879 SendCreatureChatMessageInRange(dynamic_cast<Creature*>(this), text->id, target);
6880}
@ EVENT_UNIT_CHAT_MSG
Definition EventMgr.h:41
void SendCreatureChatMessageInRange(Creature *creature, uint32_t textId, Unit *target=nullptr)
Definition Object.cpp:4518
void sendChatMessage(uint8_t type, uint32_t language, std::string msg, Unit *receiver=nullptr, uint32_t sessionLanguage=0)
Definition Unit.cpp:6851
Here is the call graph for this function:

◆ sendChatMessage() [2/3]

void Unit::sendChatMessage ( uint8_t  type,
uint32_t  language,
std::string  msg,
uint32_t  delay 
)

Definition at line 6857 of file Unit.cpp.

6858{
6859 if (delay > 0)
6860 {
6862 return;
6863 }
6864
6865 sendChatMessage(type, language, msg);
6866}
Here is the call graph for this function:

◆ sendChatMessage() [3/3]

void Unit::sendChatMessage ( uint8_t  type,
uint32_t  language,
std::string  msg,
Unit receiver = nullptr,
uint32_t  sessionLanguage = 0 
)

Definition at line 6851 of file Unit.cpp.

6852{
6853 const auto data = createChatPacket(type, language, msg, target, sessionLanguage);
6854 sendMessageToSet(data.get(), true);
6855}
std::unique_ptr< WorldPacket > createChatPacket(uint8_t type, uint32_t language, std::string msg, Unit *receiver=nullptr, uint32_t sessionLanguage=0)
Definition Unit.cpp:6804
Here is the call graph for this function:

◆ sendChatMessageAlternateEntry()

void Unit::sendChatMessageAlternateEntry ( uint32_t  entry,
uint8_t  type,
uint32_t  lang,
std::string  msg 
)

Definition at line 6891 of file Unit.cpp.

6892{
6893 if (CreatureProperties const* creatureProperties = sMySQLStore.getCreatureProperties(entry))
6894 {
6895 const auto data = SmsgMessageChat(type, lang, 0, msg, getGuid(), creatureProperties->Name).serialise();
6896 sendMessageToSet(data.get(), true);
6897 }
6898}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendChatMessageToPlayer()

void Unit::sendChatMessageToPlayer ( uint8_t  type,
uint32_t  language,
std::string  msg,
Player plr 
)

Definition at line 6882 of file Unit.cpp.

6883{
6884 if (plr == nullptr)
6885 return;
6886
6887 const auto data = createChatPacket(type, language, msg, plr, plr->getSession()->language);
6888 plr->getSession()->SendPacket(data.get());
6889}
uint32_t language
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendEnvironmentalDamageLogPacket()

void Unit::sendEnvironmentalDamageLogPacket ( uint64_t  guid,
uint8_t  type,
uint32_t  damage,
uint64_t  unk = 0 
)

Definition at line 6935 of file Unit.cpp.

6936{
6937 sendMessageToSet(SmsgEnvironmentalDamageLog(guid, type, damage, unk).serialise().get(), true, false);
6938}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendFullAuraUpdate()

void Unit::sendFullAuraUpdate ( )

Definition at line 5655 of file Unit.cpp.

5656{
5657#if VERSION_STRING >= WotLK
5658 auto packetData = SmsgAuraUpdateAll(getGuid(), {});
5659 auto updates = 0u;
5660
5661 for (const auto& aur : getAuraList())
5662 {
5663 if (aur == nullptr)
5664 continue;
5665
5666 // Update only auras with a visual slot
5667 if (aur->m_visualSlot == 0xFF)
5668 continue;
5669
5670 SmsgAuraUpdateAll::AuraUpdate auraUpdate;
5671
5672 auraUpdate.flags = aur->getAuraFlags();
5673 auraUpdate.visualSlot = aur->m_visualSlot;
5674 auraUpdate.spellId = aur->getSpellId();
5675
5676 const auto casterUnit = aur->GetUnitCaster();
5677 if (casterUnit != nullptr)
5678 auraUpdate.level = static_cast<uint8_t>(casterUnit->getLevel());
5679 else
5680 auraUpdate.level = static_cast<uint8_t>(worldConfig.player.playerLevelCap);
5681
5682 const uint32_t stackAmount = aur->getSpellInfo()->getMaxstack() > 0 ? aur->getStackCount() : aur->getCharges();
5683 auraUpdate.stackCount = static_cast<uint8_t>(stackAmount <= 255 ? stackAmount : 255);
5684
5685 if (!(auraUpdate.flags & AFLAG_IS_CASTER))
5686 auraUpdate.casterGuid = aur->getCasterGuid();
5687
5688 if (auraUpdate.flags & AFLAG_DURATION)
5689 {
5690 auraUpdate.duration = aur->getMaxDuration();
5691 auraUpdate.timeLeft = aur->getTimeLeft();
5692 }
5693
5694#if VERSION_STRING >= Cata
5695 if (auraUpdate.flags & AFLAG_SEND_EFFECT_AMOUNT)
5696 {
5697 for (uint8_t x = 0; x < MAX_SPELL_EFFECTS; ++x)
5698 {
5699 if (aur->getAuraEffect(x)->getAuraEffectType() != SPELL_AURA_NONE)
5700 auraUpdate.effAmount[x] = aur->getAuraEffect(x)->getEffectDamage();
5701 else
5702 auraUpdate.effAmount[x] = 0;
5703 }
5704 }
5705#endif
5706
5707 packetData.addAuraUpdate(auraUpdate);
5708 ++updates;
5709 }
5710
5711 sendMessageToSet(packetData.serialise().get(), true);
5712 sLogger.debug("Unit::sendFullAuraUpdate : Updated {} auras for guid {}", updates, getGuid());
5713#endif
5714}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendMoveSplinePaket()

void Unit::sendMoveSplinePaket ( UnitSpeedType  speed_type)

Definition at line 3238 of file Unit.cpp.

3239{
3240 WorldPacket data(12);
3241
3242 switch (speedType)
3243 {
3244 case TYPE_WALK:
3245 data.Initialize(SMSG_SPLINE_SET_WALK_SPEED);
3246 break;
3247 case TYPE_RUN:
3248 data.Initialize(SMSG_SPLINE_SET_RUN_SPEED);
3249 break;
3250 case TYPE_RUN_BACK:
3251 data.Initialize(SMSG_SPLINE_SET_RUN_BACK_SPEED);
3252 break;
3253 case TYPE_SWIM:
3254 data.Initialize(SMSG_SPLINE_SET_SWIM_SPEED);
3255 break;
3256 case TYPE_SWIM_BACK:
3257 data.Initialize(SMSG_SPLINE_SET_SWIM_BACK_SPEED);
3258 break;
3259 case TYPE_TURN_RATE:
3260 data.Initialize(SMSG_SPLINE_SET_TURN_RATE);
3261 break;
3262 case TYPE_FLY:
3263 data.Initialize(SMSG_SPLINE_SET_FLIGHT_SPEED);
3264 break;
3265 case TYPE_FLY_BACK:
3266 data.Initialize(SMSG_SPLINE_SET_FLIGHT_BACK_SPEED);
3267 break;
3268#if VERSION_STRING > TBC
3269 case TYPE_PITCH_RATE:
3270 data.Initialize(SMSG_SPLINE_SET_PITCH_RATE);
3271 break;
3272#endif
3273 }
3274
3275 data << GetNewGUID();
3276 data << float(getSpeedRate(speedType, true));
3277
3278 sendMessageToSet(&data, false);
3279}
@ SMSG_SPLINE_SET_FLIGHT_SPEED
Definition Opcodes.hpp:983
@ SMSG_SPLINE_SET_SWIM_SPEED
Definition Opcodes.hpp:838
@ SMSG_SPLINE_SET_FLIGHT_BACK_SPEED
Definition Opcodes.hpp:984
@ SMSG_SPLINE_SET_WALK_SPEED
Definition Opcodes.hpp:839
@ SMSG_SPLINE_SET_RUN_BACK_SPEED
Definition Opcodes.hpp:837
@ SMSG_SPLINE_SET_RUN_SPEED
Definition Opcodes.hpp:836
@ SMSG_SPLINE_SET_TURN_RATE
Definition Opcodes.hpp:841
@ SMSG_SPLINE_SET_PITCH_RATE
Definition Opcodes.hpp:1250
@ SMSG_SPLINE_SET_SWIM_BACK_SPEED
Definition Opcodes.hpp:840
@ TYPE_RUN_BACK
@ TYPE_SWIM_BACK
@ TYPE_SWIM
@ TYPE_FLY_BACK
@ TYPE_FLY
Here is the call graph for this function:

◆ sendPeriodicAuraLog()

bool Unit::sendPeriodicAuraLog ( const WoWGuid casterGuid,
const WoWGuid targetGuid,
SpellInfo const spellInfo,
uint32_t  amount,
uint32_t  overKillOrOverHeal,
uint32_t  absorbed,
uint32_t  resisted,
AuraEffect  auraEffect,
bool  isCritical,
uint32_t  miscValue = 0,
float  gainMultiplier = 0.0f 
)

Definition at line 5716 of file Unit.cpp.

5717{
5718 if (spellInfo == nullptr)
5719 return false;
5720
5721 // Classic does not use school mask
5722 uint32_t school = 0;
5723#if VERSION_STRING == Classic
5724 school = spellInfo->getFirstSchoolFromSchoolMask();
5725#else
5726 school = spellInfo->getSchoolMask();
5727#endif
5728
5729 switch (auraEffect)
5730 {
5738 break;
5739 default:
5740 return false;
5741 }
5742
5743 sendMessageToSet(SmsgPeriodicAuraLog(targetGuid, casterGuid, spellInfo->getId(), auraEffect, amount, overKillOrOverHeal, school, absorbed, resisted, isCritical, miscValue, gainMultiplier).serialise().get(), true);
5744 return true;
5745}
@ SPELL_AURA_PERIODIC_POWER_PCT
@ SPELL_AURA_PERIODIC_DAMAGE
@ SPELL_AURA_PERIODIC_HEAL_PCT
@ SPELL_AURA_PERIODIC_MANA_LEECH
@ SPELL_AURA_PERIODIC_HEAL
@ SPELL_AURA_PERIODIC_DAMAGE_PERCENT
@ SPELL_AURA_PERIODIC_ENERGIZE
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendPowerUpdate()

void Unit::sendPowerUpdate ( bool  self)

Definition at line 6734 of file Unit.cpp.

6735{
6736 // Save current power so the same amount is sent to player and everyone else
6737 const auto powerAmount = getPower(getPowerType());
6738
6739#if VERSION_STRING >= WotLK
6740 sendMessageToSet(SmsgPowerUpdate(GetNewGUID(), static_cast<uint8_t>(getPowerType()), powerAmount).serialise().get(), self);
6741#endif
6742}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendSpellEnergizeLog()

void Unit::sendSpellEnergizeLog ( Unit target,
uint32_t  spellId,
uint32_t  amount,
PowerType  type 
)

Definition at line 6699 of file Unit.cpp.

6700{
6701 sendMessageToSet(SmsgSpellEnergizeLog(target->GetNewGUID(), GetNewGUID(), spellId, type, amount).serialise().get(), true);
6702}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendSpellHealLog()

void Unit::sendSpellHealLog ( Object caster,
Object target,
uint32_t  spellId,
uint32_t  healAmount,
bool  isCritical,
uint32_t  overHeal,
uint32_t  absorbedHeal 
)

Definition at line 4272 of file Unit.cpp.

4273{
4274 if (caster == nullptr || target == nullptr)
4275 return;
4276
4277 target->sendMessageToSet(SmsgSpellHealLog(target->GetNewGUID(), caster->GetNewGUID(), spellId, healAmount, overHeal, absorbedHeal, isCritical).serialise().get(), true);
4278}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendSpellNonMeleeDamageLog()

void Unit::sendSpellNonMeleeDamageLog ( Object caster,
Object target,
SpellInfo const spellInfo,
uint32_t  damage,
uint32_t  absorbedDamage,
uint32_t  resistedDamage,
uint32_t  blockedDamage,
uint32_t  overKill,
bool  isPeriodicDamage,
bool  isCriticalHit 
)

Definition at line 4232 of file Unit.cpp.

4233{
4234 if (caster == nullptr || target == nullptr || spellInfo == nullptr)
4235 return;
4236
4237 // Classic does not use school mask
4238 uint32_t school = 0;
4239#if VERSION_STRING == Classic
4240 school = spellInfo->getFirstSchoolFromSchoolMask();
4241#else
4242 school = spellInfo->getSchoolMask();
4243#endif
4244
4246
4247 data << target->GetNewGUID();
4248 data << caster->GetNewGUID();
4249 data << uint32_t(spellInfo->getId());
4250 data << uint32_t(damage);
4251#if VERSION_STRING >= WotLK
4252 data << uint32_t(overKill);
4253#endif
4254 data << uint8_t(school);
4255 data << uint32_t(absorbedDamage);
4256 data << uint32_t(resistedDamage);
4257 data << uint8_t(isPeriodicDamage);
4258 data << uint8_t(0); // unk
4259 data << uint32_t(blockedDamage);
4260
4261 // Some sort of hit info, other values need more research
4262 if (isCriticalHit)
4263 data << uint32_t(0x2);
4264 else
4265 data << uint32_t(0);
4266
4267 data << uint8_t(0); // debug mode boolean
4268
4269 target->sendMessageToSet(&data, true);
4270}
@ SMSG_SPELLNONMELEEDAMAGELOG
Definition Opcodes.hpp:652
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendSpellOrDamageImmune()

void Unit::sendSpellOrDamageImmune ( uint64_t  casterGuid,
Unit target,
uint32_t  spellId 
)

Definition at line 4280 of file Unit.cpp.

4281{
4282 target->sendMessageToSet(SmsgSpellOrDamageImmune(casterGuid, target->getGuid(), spellId).serialise().get(), true);
4283}
Here is the call graph for this function:

◆ setAItoUse()

void Unit::setAItoUse ( bool  value)
inline

Definition at line 707 of file Unit.hpp.

707{ m_useAI = value; }
Here is the caller graph for this function:

◆ setAttackPower()

void Unit::setAttackPower ( uint32_t  value)

Definition at line 1591 of file Unit.cpp.

1591{ write(unitData()->attack_power, value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAttackPowerMods()

void Unit::setAttackPowerMods ( int32_t  modifier)

Definition at line 1633 of file Unit.cpp.

1634{
1635#if VERSION_STRING < Cata
1636 write(unitData()->attack_power_mods, modifier);
1637#else
1638 write(unitData()->attack_power_mod_neg, static_cast<uint32_t>(modifier < 0 ? modifier : 0));
1639 write(unitData()->attack_power_mod_pos, static_cast<uint32_t>(modifier > 0 ? modifier : 0));
1640#endif
1641}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAttackPowerMultiplier()

void Unit::setAttackPowerMultiplier ( float  multiplier)

Definition at line 1655 of file Unit.cpp.

1655{ write(unitData()->attack_power_multiplier, multiplier); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAttackTimer()

void Unit::setAttackTimer ( WeaponDamageType  type,
uint32_t  time 
)

Definition at line 6902 of file Unit.cpp.

6903{
6905}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAuraState()

void Unit::setAuraState ( uint32_t  state)

Definition at line 1229 of file Unit.cpp.

1229{ write(unitData()->aura_state, state); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAuraUpdateMaskForRaid()

void Unit::setAuraUpdateMaskForRaid ( uint8_t  slot)
inline

Definition at line 1286 of file Unit.hpp.

1286{ m_auraRaidUpdateMask |= (uint64_t(1) << slot); }
Here is the caller graph for this function:

◆ setBaseAttackTime()

void Unit::setBaseAttackTime ( uint8_t  slot,
uint32_t  time 
)

Definition at line 1234 of file Unit.cpp.

1234{ write(unitData()->base_attack_time[slot], time); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBaseHealth()

void Unit::setBaseHealth ( uint32_t  baseHealth)

Definition at line 1474 of file Unit.cpp.

1474{ write(unitData()->base_health, baseHealth); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBaseMana()

void Unit::setBaseMana ( uint32_t  baseMana)

Definition at line 1471 of file Unit.cpp.

1471{ write(unitData()->base_mana, baseMana); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBlockFromSpell()

void Unit::setBlockFromSpell ( float  value)
inline

Definition at line 1521 of file Unit.hpp.

Here is the caller graph for this function:

◆ setBoundingRadius()

void Unit::setBoundingRadius ( float  radius)

Definition at line 1247 of file Unit.cpp.

1247{ write(unitData()->bounding_radius, radius); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBytes0()

void Unit::setBytes0 ( uint32_t  bytes)

Definition at line 411 of file Unit.cpp.

411{ write(unitData()->field_bytes_0.raw, bytes); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBytes0ForOffset()

void Unit::setBytes0ForOffset ( uint32_t  offset,
uint8_t  value 
)

Definition at line 431 of file Unit.cpp.

432{
433 switch (offset)
434 {
435 case 0:
436 setRace(value);
437 break;
438 case 1:
440 break;
441 case 2:
443 break;
444 case 3:
446 break;
447 default:
448 sLogger.failure("Offset {} is not a valid offset value for byte_0 data (max 3)", offset);
449 break;
450 }
451}
void setClass(uint8_t class_)
Definition Unit.cpp:457
void setGender(uint8_t gender)
Definition Unit.cpp:460
void setRace(uint8_t race)
Definition Unit.cpp:454
void setPowerType(uint8_t powerType)
Definition Unit.cpp:463
Here is the call graph for this function:

◆ setBytes1()

void Unit::setBytes1 ( uint32_t  bytes)

Definition at line 1295 of file Unit.cpp.

1295{ write(unitData()->field_bytes_1.raw, bytes); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBytes1ForOffset()

void Unit::setBytes1ForOffset ( uint32_t  offset,
uint8_t  value 
)

Definition at line 1329 of file Unit.cpp.

1330{
1331 switch (offset)
1332 {
1333 case 0:
1335 break;
1336 case 1:
1337#if VERSION_STRING < WotLK
1338 setPetLoyalty(value);
1339#elif VERSION_STRING < Mop
1340 setPetTalentPoints(value);
1341#else
1342 write(unitData()->field_bytes_1.s.unk1, value);
1343#endif
1344 break;
1345 case 2:
1346#if VERSION_STRING == Classic
1348#else
1350#endif
1351 break;
1352 case 3:
1353#if VERSION_STRING == Classic
1355#else
1356 setAnimationFlags(value);
1357#endif
1358 break;
1359 default:
1360 sLogger.failure("Offset {} is not a valid offset value for byte_1 data (max 3)", offset);
1361 break;
1362 }
1363}
void setShapeShiftForm(uint8_t shapeShiftForm)
Definition Unit.cpp:1387
Here is the call graph for this function:

◆ setBytes2()

void Unit::setBytes2 ( uint32_t  bytes)

Definition at line 1478 of file Unit.cpp.

1478{ write(unitData()->field_bytes_2.raw, bytes); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBytes2ForOffset()

void Unit::setBytes2ForOffset ( uint32_t  offset,
uint8_t  value 
)

Definition at line 1512 of file Unit.cpp.

1513{
1514 switch (offset)
1515 {
1516 case 0:
1518 break;
1519 case 1:
1520#if VERSION_STRING == Classic
1521 write(unitData()->field_bytes_2.s.unk1, value);
1522#elif VERSION_STRING == TBC
1524#else
1525 setPvpFlags(value);
1526#endif
1527 break;
1528 case 2:
1529#if VERSION_STRING == Classic
1530 write(unitData()->field_bytes_2.s.unk2, value);
1531#else
1533#endif
1534 break;
1535 case 3:
1536#if VERSION_STRING == Classic
1537 write(unitData()->field_bytes_2.s.unk3, value);
1538#else
1540#endif
1541 break;
1542 default:
1543 sLogger.failure("Offset {} is not a valid offset value for byte_2 data (max 3)", offset);
1544 break;
1545 }
1546}
void setPositiveAuraLimit(uint8_t limit)
Definition Unit.cpp:1553
void setSheathType(uint8_t sheathType)
Definition Unit.cpp:1549
Here is the call graph for this function:

◆ setcanparry()

void Unit::setcanparry ( bool  newstatus)
inline

Definition at line 1434 of file Unit.hpp.

1434{ m_canParry = newstatus; }
Here is the caller graph for this function:

◆ setChannelObjectGuid()

void Unit::setChannelObjectGuid ( uint64_t  guid)

Definition at line 404 of file Unit.cpp.

404{ write(unitData()->channel_object_guid.guid, guid); }
guid_union guid
Definition WoWObject.hpp:45
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setChannelSpellId()

void Unit::setChannelSpellId ( uint32_t  spell_id)

Definition at line 407 of file Unit.cpp.

407{ write(unitData()->channel_spell, spell_id); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCharmedByGuid()

void Unit::setCharmedByGuid ( uint64_t  guid)

Definition at line 392 of file Unit.cpp.

392{ write(unitData()->charmed_by_guid.guid, guid); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCharmGuid()

void Unit::setCharmGuid ( uint64_t  guid)

Definition at line 381 of file Unit.cpp.

381{ write(unitData()->charm_guid.guid, guid); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCharmTempVal()

void Unit::setCharmTempVal ( uint32_t  val)
inline

Definition at line 1484 of file Unit.hpp.

1484{ m_tempCharm = val; }
Here is the caller graph for this function:

◆ setClass()

void Unit::setClass ( uint8_t  class_)

Definition at line 457 of file Unit.cpp.

457{ write(unitData()->field_bytes_0.s.unit_class, class_); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCombatReach()

void Unit::setCombatReach ( float  radius)

Definition at line 1250 of file Unit.cpp.

1250{ write(unitData()->combat_reach, radius); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setConfused()

void Unit::setConfused ( bool  apply)
protected

Definition at line 3072 of file Unit.cpp.

3073{
3074 if (apply)
3075 {
3076 setTargetGuid(0);
3078 }
3079 else
3080 {
3081 if (isAlive())
3082 {
3084 if (getThreatManager().getCurrentVictim())
3085 setTargetGuid(getThreatManager().getCurrentVictim()->getGuid());
3086 }
3087 }
3088
3089 // block / allow control to real player in control (eg charmer)
3090 if (isPlayer())
3091 {
3092 if (auto* const plrOwner = getPlayerOwnerOrSelf())
3093 plrOwner->sendClientControlPacket(this, !apply);
3094 }
3095}
@ CONFUSED_MOTION_TYPE
void remove(MovementGenerator *movement, MovementSlot slot=MOTION_SLOT_ACTIVE)
void setTargetGuid(uint64_t guid)
Definition Unit.cpp:401
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setControlled()

void Unit::setControlled ( bool  apply,
UnitStates  state 
)

Definition at line 3348 of file Unit.cpp.

3349{
3350 if (apply)
3351 {
3352 if (hasUnitStateFlag(state))
3353 return;
3354
3355 addUnitStateFlag(state);
3356 switch (state)
3357 {
3358 case UNIT_STATE_STUNNED:
3359 setStunned(true);
3360 break;
3361 case UNIT_STATE_ROOTED:
3363 setMoveRoot(true);
3364 break;
3367 {
3369 setConfused(true);
3370 }
3371 break;
3372 case UNIT_STATE_FLEEING:
3374 {
3376 setFeared(true);
3377 }
3378 break;
3379 default:
3380 break;
3381 }
3382 }
3383 else
3384 {
3385 switch (state)
3386 {
3387 case UNIT_STATE_STUNNED:
3389 return;
3390
3391 removeUnitStateFlag(state);
3392 setStunned(false);
3393 break;
3394 case UNIT_STATE_ROOTED:
3395 if (getAuraWithAuraEffect(SPELL_AURA_MOD_ROOT) || isVehicle() || (ToCreature() && ToCreature()->getMovementTemplate().isRooted()))
3396 return;
3397
3398 removeUnitStateFlag(state);
3399 setMoveRoot(false);
3400 break;
3403 return;
3404
3405 removeUnitStateFlag(state);
3406 setConfused(false);
3407 break;
3408 case UNIT_STATE_FLEEING:
3410 return;
3411
3412 removeUnitStateFlag(state);
3413 setFeared(false);
3414 break;
3415 default:
3416 return;
3417 }
3418
3420 }
3421}
@ UNIT_STATE_MELEE_ATTACKING
void applyControlStatesIfNeeded()
Definition Unit.cpp:3423
void addUnitStateFlag(uint32_t state_flag)
Definition Unit.hpp:716
bool isRooted() const
Definition Unit.cpp:1945
void removeUnitStateFlag(uint32_t state_flag)
Definition Unit.hpp:718
Here is the call graph for this function:

◆ setCreatedByGuid()

void Unit::setCreatedByGuid ( uint64_t  guid)

Definition at line 398 of file Unit.cpp.

398{ write(unitData()->created_by_guid.guid, guid); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCreatedBySpellId()

void Unit::setCreatedBySpellId ( uint32_t  id)

Definition at line 1431 of file Unit.cpp.

1431{ write(unitData()->created_by_spell_id, id); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDeathState()

void Unit::setDeathState ( DeathState  state)
virtual

Reimplemented in Creature, and Pet.

Definition at line 7875 of file Unit.cpp.

7876{
7878
7879#ifdef FT_VEHICLES
7880 bool isOnVehicle = getVehicle() != nullptr;
7881#else
7882 bool isOnVehicle = false;
7883#endif
7884
7885 if (state != ALIVE && state != JUST_RESPAWNED)
7886 {
7887#ifdef FT_VEHICLES
7888 exitVehicle();
7889#endif
7891
7892 if (!isPet())
7894 }
7895
7896 if (state == JUST_DIED)
7897 {
7900
7901 // Don't clear the movement if the Unit was on a vehicle as we are exiting now
7902 if (!isOnVehicle)
7903 {
7904 if (IsInWorld())
7905 {
7908 }
7909
7910 stopMoving();
7911 disableSpline();
7912 }
7913
7914 setHealth(0);
7915 setPower(getPowerType(), 0);
7916 setEmoteState(0);
7917 }
7918 else if (state == JUST_RESPAWNED)
7919 {
7920 removeUnitFlags(UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player
7921 }
7922}
@ UNIT_FLAG_SKINNABLE
@ JUST_RESPAWNED
void disableSpline()
Definition Unit.cpp:3281
void removeAllNonPersistentAuras()
Definition Unit.cpp:5451
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDetectRangeMod()

bool Unit::setDetectRangeMod ( uint64_t  guid,
int32_t  amount 
)

Definition at line 7590 of file Unit.cpp.

7591{
7592 int next_free_slot = -1;
7593 for (uint8_t i = 0; i < 5; i++)
7594 {
7595 if (m_detectRangeGuids[i] == 0 && next_free_slot == -1)
7596 {
7597 next_free_slot = i;
7598 }
7599 if (m_detectRangeGuids[i] == guid)
7600 {
7601 m_detectRangeMods[i] = amount;
7602 return true;
7603 }
7604 }
7605 if (next_free_slot != -1)
7606 {
7607 m_detectRangeGuids[next_free_slot] = guid;
7608 m_detectRangeMods[next_free_slot] = amount;
7609 return true;
7610 }
7611 return false;
7612}
Here is the caller graph for this function:

◆ setDiminishTimer()

void Unit::setDiminishTimer ( uint32_t  index)
inline

Definition at line 1490 of file Unit.hpp.

1490{ m_diminishTimer[index] = 15000; }

◆ setDisplayId()

void Unit::setDisplayId ( uint32_t  id)

Definition at line 1253 of file Unit.cpp.

1254{
1255 write(unitData()->display_id, id);
1256
1257#if VERSION_STRING == TBC
1258 // TODO Fix this later
1259 return;
1260#endif
1261
1262 // Update display id also to group
1263 const auto plr = getPlayerOwnerOrSelf();
1264 if (plr == nullptr || !plr->IsInWorld() || plr->getGroup() == nullptr)
1265 return;
1266
1267 //\ todo: missing update flag for player display id
1268 plr->addGroupUpdateFlag(isPlayer() ? 0 : GROUP_UPDATE_FLAG_PET_MODEL_ID);
1269}
@ GROUP_UPDATE_FLAG_PET_MODEL_ID
Definition Group.h:66
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDodgeFromSpell()

void Unit::setDodgeFromSpell ( float  value)
inline

Definition at line 1523 of file Unit.hpp.

Here is the caller graph for this function:

◆ setDualWield()

void Unit::setDualWield ( bool  enable)

Definition at line 3542 of file Unit.cpp.

3543{
3544 m_canDualWield = enable;
3545
3546 if (!isPlayer())
3547 return;
3548
3549 auto plrUnit = dynamic_cast<Player*>(this);
3550 if (enable)
3551 {
3552 if (!plrUnit->hasSkillLine(SKILL_DUAL_WIELD))
3553 plrUnit->addSkillLine(SKILL_DUAL_WIELD, 1, 1);
3554 }
3555 else
3556 {
3557 if (plrUnit->canDualWield2H())
3558 plrUnit->setDualWield2H(false);
3559
3560 plrUnit->removeSkillLine(SKILL_DUAL_WIELD);
3561 }
3562}
@ SKILL_DUAL_WIELD
Definition Skill.hpp:45
void addSkillLine(uint16_t skillLine, uint16_t currentValue, uint16_t maxValue, bool noSpellLearning=false, bool initializeProfession=false)
Definition Player.cpp:4760
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setEmoteState()

void Unit::setEmoteState ( uint32_t  id)

Definition at line 1446 of file Unit.cpp.

1446{ write(unitData()->npc_emote_state, id); }
Here is the call graph for this function:

◆ setFacing()

void Unit::setFacing ( float  newo)

Definition at line 2446 of file Unit.cpp.

2447{
2448 SetOrientation(newo);
2449
2451 data << GetNewGUID();
2452 data << GetPositionX();
2453 data << GetPositionY();
2454 data << GetPositionZ();
2455 data << Util::getMSTime();
2456 if (newo != 0.0f)
2457 {
2458 data << uint8_t(4);
2459 data << newo;
2460 }
2461 else
2462 {
2463 data << uint8_t(0);
2464 }
2465
2466 data << uint32_t(0x1000); // move flags: run
2467 data << uint32_t(0); // movetime
2468 data << uint32_t(1); // 1 point
2469 data << GetPositionX();
2470 data << GetPositionY();
2471 data << GetPositionZ();
2472
2473 sendMessageToSet(&data, true);
2474}
@ SMSG_MONSTER_MOVE
Definition Opcodes.hpp:265
void SetOrientation(float o)
Definition Object.hpp:358
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFacingTo()

void Unit::setFacingTo ( float const  ori,
bool  force = true 
)

IsStopped() ||

Definition at line 1963 of file Unit.cpp.

1964{
1965 // do not face when already moving
1966 if (!force && (/*!IsStopped() ||*/ !movespline->Finalized()))
1967 return;
1968
1970 init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ(), false);
1971
1972 if (getTransGuid())
1973 init.DisableTransportPathTransformations(); // It makes no sense to target global orientation
1974 init.SetFacing(ori);
1975
1976 init.Launch();
1977}
uint64_t getTransGuid()
Definition Unit.cpp:7998
static int init(void **a)
Definition ltm_desc.c:44
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFacingToObject()

void Unit::setFacingToObject ( Object object,
bool  force = true 
)

IsStopped() ||

Definition at line 1979 of file Unit.cpp.

1980{
1981 // do not face when already moving
1982 if (!force && (/*!IsStopped() ||*/ !movespline->Finalized()))
1983 return;
1984
1986 init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ(), false);
1987 init.SetFacing(getAbsoluteAngle(object)); // when on transport, GetAbsoluteAngle will still return global coordinates (and angle) that needs transforming
1988
1989 init.Launch();
1990}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFaction()

void Unit::setFaction ( uint32_t  factionId)
inline

Definition at line 261 of file Unit.hpp.

262 {
263 setFactionTemplate(factionId);
265 }
void setServersideFaction()
Definition Object.cpp:3844
void setFactionTemplate(uint32_t id)
Definition Unit.cpp:958

◆ setFactionTemplate()

void Unit::setFactionTemplate ( uint32_t  id)

Definition at line 958 of file Unit.cpp.

958{ write(unitData()->faction_template, id); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFeared()

void Unit::setFeared ( bool  apply)
protected

Definition at line 3034 of file Unit.cpp.

3035{
3036 if (apply)
3037 {
3038 setTargetGuid(0);
3039
3040 Unit* caster = nullptr;
3041 if (const auto fearAura = getAuraWithAuraEffect(SPELL_AURA_MOD_FEAR))
3042 caster = fearAura->GetUnitCaster();
3043
3044 if (caster == nullptr)
3045 caster = getAIInterface()->getCurrentTarget();
3046
3047 getMovementManager()->moveFleeing(caster); // caster == NULL processed in MoveFleeing
3048 }
3049 else
3050 {
3051 if (isAlive())
3052 {
3054 if (getThreatManager().getCurrentVictim())
3055 setTargetGuid(getThreatManager().getCurrentVictim()->getGuid());
3056
3057 if (!isPlayer() && !isInCombat() && getTargetGuid() == 0)
3059 else
3060 getMovementManager()->moveChase(getThreatManager().getCurrentVictim());
3061 }
3062 }
3063
3064 // block / allow control to real player in control (eg charmer)
3065 if (isPlayer())
3066 {
3067 if (auto* const plrOwner = getPlayerOwnerOrSelf())
3068 plrOwner->sendClientControlPacket(this, !apply);
3069 }
3070}
@ FLEEING_MOTION_TYPE
Unit * getCurrentTarget() const
void moveFleeing(Unit *enemy, uint32_t time=0)
void moveChase(Unit *target, Optional< ChaseRange > dist={}, Optional< ChaseAngle > angle={})
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFfaPvpFlag()

void Unit::setFfaPvpFlag ( )
virtual

Reimplemented in Creature, and Player.

Definition at line 6945 of file Unit.cpp.

6945{}

◆ setFullHealth()

void Unit::setFullHealth ( )

Definition at line 513 of file Unit.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setGender()

void Unit::setGender ( uint8_t  gender)

Definition at line 460 of file Unit.cpp.

460{ write(unitData()->field_bytes_0.s.gender, gender); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setHealth()

void Unit::setHealth ( uint32_t  health)

Definition at line 482 of file Unit.cpp.

483{
484 const auto maxHealth = getMaxHealth();
485 if (health > maxHealth)
486 health = maxHealth;
487
488 write(unitData()->health, health);
489
490#if VERSION_STRING == TBC
491 // TODO Fix this later
492 return;
493#endif
494
495 // Update health also to group
496 const auto plr = getPlayerOwnerOrSelf();
497 if (plr == nullptr || !plr->IsInWorld() || plr->getGroup() == nullptr)
498 return;
499
501}
@ GROUP_UPDATE_FLAG_CUR_HP
Definition Group.h:55
@ GROUP_UPDATE_FLAG_PET_CUR_HP
Definition Group.h:67
Here is the call graph for this function:

◆ setHealthPct()

void Unit::setHealthPct ( uint32_t  val)

Definition at line 514 of file Unit.cpp.

514{ if (val > 0) setHealth(Util::float2int32(val * 0.01f * getMaxHealth())); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setHitFromMeleeSpell()

void Unit::setHitFromMeleeSpell ( float  value)
inline

Definition at line 1342 of file Unit.hpp.

Here is the caller graph for this function:

◆ setHoverHeight()

void Unit::setHoverHeight ( float  height)

Definition at line 1704 of file Unit.cpp.

1704{ write(unitData()->hover_height, height); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setInFront()

void Unit::setInFront ( Object const target)

Definition at line 1957 of file Unit.cpp.

1958{
1961}
@ UNIT_STATE_CANNOT_TURN
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLevel()

void Unit::setLevel ( uint32_t  level)

Definition at line 937 of file Unit.cpp.

938{
939 write(unitData()->level, level);
940 if (isPlayer())
941 dynamic_cast<Player*>(this)->setNextLevelXp(sMySQLStore.getPlayerXPForLevel(level));
942
943#if VERSION_STRING == TBC
944 // TODO Fix this later
945 return;
946#endif
947
948 // Update level also to group
949 const auto plr = getPlayerOwnerOrSelf();
950 if (plr == nullptr || !plr->IsInWorld() || plr->getGroup() == nullptr)
951 return;
952
953 //\ todo: missing update flag for pet level
954 plr->addGroupUpdateFlag(isPlayer() ? GROUP_UPDATE_FLAG_LEVEL : 0);
955}
@ GROUP_UPDATE_FLAG_LEVEL
Definition Group.h:60
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLocationWithoutUpdate()

void Unit::setLocationWithoutUpdate ( LocationVector location)

Definition at line 1710 of file Unit.cpp.

1711{
1712 m_position.ChangeCoords({ location.x, location.y, location.z });
1713}
void ChangeCoords(const LocationVector &src)
LocationVector m_position
Definition Object.hpp:744
Here is the call graph for this function:

◆ setMaxDamage()

void Unit::setMaxDamage ( float  damage)

Definition at line 1285 of file Unit.cpp.

1285{ write(unitData()->maximum_damage, damage); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMaxHealth()

void Unit::setMaxHealth ( uint32_t  maxHealth)

Definition at line 626 of file Unit.cpp.

627{
628 write(unitData()->max_health, maxHealth);
629
630#if VERSION_STRING == TBC
631 // TODO Fix this later
632 return;
633#endif
634
635 // Update health also to group
636 const auto plr = getPlayerOwnerOrSelf();
637 if (plr != nullptr && plr->IsInWorld() && plr->getGroup() != nullptr)
639
640 if (maxHealth < getHealth())
641 setHealth(maxHealth);
642}
@ GROUP_UPDATE_FLAG_MAX_HP
Definition Group.h:56
@ GROUP_UPDATE_FLAG_PET_MAX_HP
Definition Group.h:68
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMaxOffhandDamage()

void Unit::setMaxOffhandDamage ( float  damage)

Definition at line 1291 of file Unit.cpp.

1291{ write(unitData()->maximum_offhand_damage, damage); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMaxPower()

void Unit::setMaxPower ( PowerType  type,
uint32_t  value 
)

Definition at line 685 of file Unit.cpp.

686{
687 if (type == POWER_TYPE_HEALTH)
688 {
690 return;
691 }
692
693 // Since cata power fields work differently
694 // Get matching power index by power type
695 const auto powerIndex = getPowerIndexFromDBC(type);
696 switch (powerIndex)
697 {
699 write(unitData()->max_power_1, value);
700 break;
702 write(unitData()->max_power_2, value);
703 break;
705 write(unitData()->max_power_3, value);
706 break;
708 write(unitData()->max_power_4, value);
709 break;
711 write(unitData()->max_power_5, value);
712 break;
713#if VERSION_STRING == WotLK
715 write(unitData()->max_power_6, value);
716 break;
718 write(unitData()->max_power_7, value);
719 break;
720#endif
721 default:
722 return;
723 }
724
725#if VERSION_STRING == TBC
726 // TODO Fix this later
727 return;
728#endif
729
730 // Update power also to group
731 const auto plr = getPlayerOwnerOrSelf();
732 if (plr != nullptr && plr->IsInWorld() && plr->getGroup() != nullptr)
734
735 if (value < getPower(type))
736 setPower(type, value);
737}
@ GROUP_UPDATE_FLAG_PET_MAX_POWER
Definition Group.h:71
@ GROUP_UPDATE_FLAG_MAX_POWER
Definition Group.h:59
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMaxRangedDamage()

void Unit::setMaxRangedDamage ( float  damage)

Definition at line 1600 of file Unit.cpp.

1600{ write(unitData()->maximum_ranged_ddamage, damage); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMinDamage()

void Unit::setMinDamage ( float  damage)

Definition at line 1282 of file Unit.cpp.

1282{ write(unitData()->minimum_damage, damage); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMinOffhandDamage()

void Unit::setMinOffhandDamage ( float  damage)

Definition at line 1288 of file Unit.cpp.

1288{ write(unitData()->minimum_offhand_damage, damage); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMinRangedDamage()

void Unit::setMinRangedDamage ( float  damage)

Definition at line 1597 of file Unit.cpp.

1597{ write(unitData()->minimum_ranged_damage, damage); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setModCastSpeed()

void Unit::setModCastSpeed ( float  modifier)

Definition at line 1422 of file Unit.cpp.

1422{ write(unitData()->mod_cast_speed, modifier); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMountDisplayId()

void Unit::setMountDisplayId ( uint32_t  id)

Definition at line 1279 of file Unit.cpp.

1279{ write(unitData()->mount_display_id, id); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMoveCanFly()

void Unit::setMoveCanFly ( bool  set_fly)

Definition at line 2175 of file Unit.cpp.

2176{
2177 if (isPlayer())
2178 {
2179 if (set_fly)
2180 {
2182
2183 // Remove falling flag if set
2185
2187#if VERSION_STRING < Cata
2188 data << GetNewGUID();
2189 data << uint32_t(2);
2190#else
2192#endif
2193
2194 sendMessageToSet(&data, true);
2195 }
2196 else
2197 {
2198 // Remove all fly related moveflags
2200#if VERSION_STRING > TBC
2202#endif
2204
2206#if VERSION_STRING < Cata
2207 data << GetNewGUID();
2208 data << uint32_t(5);
2209#else
2211#endif
2212
2213 sendMessageToSet(&data, true);
2214 }
2215 }
2216
2217 if (isCreature())
2218 {
2219 if (set_fly == hasUnitMovementFlag(MOVEFLAG_CAN_FLY))
2220 return;
2221
2222 if (set_fly)
2223 {
2226 }
2227 else
2228 {
2230 }
2231
2232 if (!movespline->Initialized())
2233 return;
2234
2236#if VERSION_STRING < Cata
2237 data << GetNewGUID();
2238#else
2240#endif
2241 sendMessageToSet(&data, false);
2242 }
2243}
@ MOVEFLAG_ASCENDING
@ MOVEFLAG_DESCENDING
@ MOVEFLAG_CAN_FLY
@ SMSG_SPLINE_MOVE_SET_FLYING
Definition Opcodes.hpp:1739
@ SMSG_MOVE_SET_CAN_FLY
Definition Opcodes.hpp:916
@ SMSG_SPLINE_MOVE_UNSET_FLYING
Definition Opcodes.hpp:1145
@ SMSG_MOVE_UNSET_CAN_FLY
Definition Opcodes.hpp:917
void addUnitMovementFlag(uint32_t f)
Definition Unit.cpp:1935
void removeUnitMovementFlag(uint32_t f)
Definition Unit.cpp:1936
void writeMovementInfo(ByteBuffer &data, uint16_t opcode, float custom_speed=0.f, ExtraMovementStatusElement *extras=nullptr) const
Definition Object.cpp:5465
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMoveDisableGravity()

void Unit::setMoveDisableGravity ( bool  disable_gravity)

Definition at line 2340 of file Unit.cpp.

2341{
2342#if VERSION_STRING > TBC
2343 if (isPlayer())
2344 {
2345 if (disable_gravity)
2346 {
2348
2350#if VERSION_STRING < Cata
2351 data << GetNewGUID();
2352 data << uint32_t(0);
2353#else
2355#endif
2356 sendMessageToSet(&data, true);
2357 }
2358 else
2359 {
2361
2363#if VERSION_STRING < Cata
2364 data << GetNewGUID();
2365 data << uint32_t(0);
2366#else
2368#endif
2369 sendMessageToSet(&data, true);
2370 }
2371 }
2372
2373 if (isCreature())
2374 {
2375 if (disable_gravity == hasUnitMovementFlag(MOVEFLAG_DISABLEGRAVITY))
2376 return;
2377
2378 if (disable_gravity)
2379 {
2382 }
2383 else
2384 {
2386 }
2387
2389 {
2391 setAnimationFlags(ANIMATION_FLAG_FLY);
2392 else if (isHovering())
2393 setAnimationFlags(ANIMATION_FLAG_HOVER);
2394 else
2395 setAnimationFlags(ANIMATION_FLAG_GROUND);
2396 }
2397
2398 if (!movespline->Initialized())
2399 return;
2400
2402#if VERSION_STRING < Cata
2403 data << GetNewGUID();
2404#else
2406#endif
2407 sendMessageToSet(&data, false);
2408 }
2409#endif
2410}
@ MOVEFLAG_DISABLEGRAVITY
@ SMSG_SPLINE_MOVE_GRAVITY_DISABLE
Definition Opcodes.hpp:1366
@ SMSG_MOVE_GRAVITY_DISABLE
Definition Opcodes.hpp:1361
@ SMSG_MOVE_GRAVITY_ENABLE
Definition Opcodes.hpp:1363
@ SMSG_SPLINE_MOVE_GRAVITY_ENABLE
Definition Opcodes.hpp:1367
@ ANIMATION_FLAG_FLY
@ ANIMATION_FLAG_HOVER
@ ANIMATION_FLAG_GROUND
bool isHovering() const
Definition Unit.hpp:587
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMoveFeatherFall()

void Unit::setMoveFeatherFall ( )

Definition at line 2048 of file Unit.cpp.

2049{
2051
2052 if (isPlayer())
2053 {
2055#if VERSION_STRING < Cata
2056 data << GetNewGUID();
2057 data << uint32_t(0);
2058#else
2060#endif
2061 sendMessageToSet(&data, true);
2062 }
2063
2064 if (isCreature())
2065 {
2067#if VERSION_STRING < Cata
2068 data << GetNewGUID();
2069#else
2071#endif
2072 sendMessageToSet(&data, false);
2073 }
2074}
@ MOVEFLAG_FEATHER_FALL
@ SMSG_MOVE_FEATHER_FALL
Definition Opcodes.hpp:752
@ SMSG_SPLINE_MOVE_FEATHER_FALL
Definition Opcodes.hpp:843
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMoveHover()

void Unit::setMoveHover ( bool  set_hover)

Definition at line 2104 of file Unit.cpp.

2105{
2106 if (isPlayer())
2107 {
2108 if (set_hover)
2109 {
2111
2113#if VERSION_STRING < Cata
2114 data << GetNewGUID();
2115 data << uint32_t(0);
2116#else
2118#endif
2119 sendMessageToSet(&data, true);
2120 }
2121 else
2122 {
2124
2126#if VERSION_STRING < Cata
2127 data << GetNewGUID();
2128 data << uint32_t(0);
2129#else
2131#endif
2132 sendMessageToSet(&data, true);
2133 }
2134 }
2135
2136 //\todo spline update
2137 if (isCreature())
2138 {
2139 if (set_hover)
2140 {
2142
2144#if VERSION_STRING < Cata
2145 data << GetNewGUID();
2146#else
2148#endif
2149 sendMessageToSet(&data, false);
2150 }
2151 else
2152 {
2154
2156#if VERSION_STRING < Cata
2157 data << GetNewGUID();
2158#else
2160#endif
2161 sendMessageToSet(&data, false);
2162 }
2163
2164#if VERSION_STRING >= TBC
2166 setAnimationFlags(ANIMATION_FLAG_FLY);
2167 else if (isHovering())
2168 setAnimationFlags(ANIMATION_FLAG_HOVER);
2169 else
2170 setAnimationFlags(ANIMATION_FLAG_GROUND);
2171#endif
2172 }
2173}
@ SMSG_MOVE_SET_HOVER
Definition Opcodes.hpp:288
@ SMSG_SPLINE_MOVE_SET_HOVER
Definition Opcodes.hpp:845
@ SMSG_SPLINE_MOVE_UNSET_HOVER
Definition Opcodes.hpp:846
@ SMSG_MOVE_UNSET_HOVER
Definition Opcodes.hpp:289
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMoveLandWalk()

void Unit::setMoveLandWalk ( )

Definition at line 2020 of file Unit.cpp.

2021{
2023
2024 if (isPlayer())
2025 {
2027#if VERSION_STRING < Cata
2028 data << GetNewGUID();
2029 data << uint32_t(0);
2030#else
2032#endif
2033 sendMessageToSet(&data, true);
2034 }
2035
2036 if (isCreature())
2037 {
2039#if VERSION_STRING < Cata
2040 data << GetNewGUID();
2041#else
2043#endif
2044 sendMessageToSet(&data, false);
2045 }
2046}
@ MOVEFLAG_WATER_WALK
@ SMSG_MOVE_LAND_WALK
Definition Opcodes.hpp:266
@ SMSG_SPLINE_MOVE_LAND_WALK
Definition Opcodes.hpp:848
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMoveNormalFall()

void Unit::setMoveNormalFall ( )

Definition at line 2076 of file Unit.cpp.

2077{
2079
2080 if (isPlayer())
2081 {
2083#if VERSION_STRING < Cata
2084 data << GetNewGUID();
2085 data << uint32_t(0);
2086#else
2088#endif
2089 sendMessageToSet(&data, true);
2090 }
2091
2092 if (isCreature())
2093 {
2095#if VERSION_STRING < Cata
2096 data << GetNewGUID();
2097#else
2099#endif
2100 sendMessageToSet(&data, false);
2101 }
2102}
@ SMSG_MOVE_NORMAL_FALL
Definition Opcodes.hpp:287
@ SMSG_SPLINE_MOVE_NORMAL_FALL
Definition Opcodes.hpp:844
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMoveRoot()

void Unit::setMoveRoot ( bool  set_root)

Definition at line 2245 of file Unit.cpp.

2246{
2247 if (isPlayer())
2248 {
2249 if (set_root)
2250 {
2252 stopMoving();
2253
2255#if VERSION_STRING < Cata
2256 data << GetNewGUID();
2257 data << uint32_t(0);
2258#else
2260#endif
2261 sendMessageToSet(&data, true);
2262 }
2263 else
2264 {
2266 stopMoving();
2267
2269#if VERSION_STRING < Cata
2270 data << GetNewGUID();
2271 data << uint32_t(0);
2272#else
2274#endif
2275 sendMessageToSet(&data, true);
2276 }
2277 }
2278
2279 if (isCreature())
2280 {
2281 if (set_root)
2282 {
2283 stopMoving();
2285
2287#if VERSION_STRING < Cata
2288 data << GetNewGUID();
2289#else
2291#endif
2292 sendMessageToSet(&data, true);
2293 }
2294 else
2295 {
2297
2299#if VERSION_STRING < Cata
2300 data << GetNewGUID();
2301#else
2303#endif
2304 sendMessageToSet(&data, true);
2305 }
2306 }
2307}
@ SMSG_FORCE_MOVE_UNROOT
Definition Opcodes.hpp:277
@ SMSG_FORCE_MOVE_ROOT
Definition Opcodes.hpp:275
@ SMSG_SPLINE_MOVE_UNROOT
Definition Opcodes.hpp:842
@ SMSG_SPLINE_MOVE_ROOT
Definition Opcodes.hpp:865
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMoveSwim()

void Unit::setMoveSwim ( bool  set_swim)

Definition at line 2309 of file Unit.cpp.

2310{
2311 if (isCreature())
2312 {
2313 if (set_swim)
2314 {
2316
2318#if VERSION_STRING < Cata
2319 data << GetNewGUID();
2320#else
2322#endif
2323 sendMessageToSet(&data, false);
2324 }
2325 else
2326 {
2328
2330#if VERSION_STRING < Cata
2331 data << GetNewGUID();
2332#else
2334#endif
2335 sendMessageToSet(&data, false);
2336 }
2337 }
2338}
@ SMSG_SPLINE_MOVE_STOP_SWIM
Definition Opcodes.hpp:850
@ SMSG_SPLINE_MOVE_START_SWIM
Definition Opcodes.hpp:849
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMoveWalk()

void Unit::setMoveWalk ( bool  set_walk)

Definition at line 2414 of file Unit.cpp.

2415{
2416 if (isCreature())
2417 {
2418 if (set_walk)
2419 {
2421
2423#if VERSION_STRING < Cata
2424 data << GetNewGUID();
2425#else
2427#endif
2428 sendMessageToSet(&data, false);
2429 }
2430 else
2431 {
2433
2435#if VERSION_STRING < Cata
2436 data << GetNewGUID();
2437#else
2439#endif
2440 sendMessageToSet(&data, false);
2441 }
2442 }
2443}
@ SMSG_SPLINE_MOVE_SET_RUN_MODE
Definition Opcodes.hpp:851
@ SMSG_SPLINE_MOVE_SET_WALK_MODE
Definition Opcodes.hpp:852
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMoveWaterWalk()

void Unit::setMoveWaterWalk ( )

Definition at line 1992 of file Unit.cpp.

1993{
1995
1996 if (isPlayer())
1997 {
1999#if VERSION_STRING < Cata
2000 data << GetNewGUID();
2001 data << uint32_t(0);
2002#else
2004#endif
2005 sendMessageToSet(&data, true);
2006 }
2007
2008 if (isCreature())
2009 {
2011#if VERSION_STRING < Cata
2012 data << GetNewGUID();
2013#else
2015#endif
2016 sendMessageToSet(&data, false);
2017 }
2018}
@ SMSG_MOVE_WATER_WALK
Definition Opcodes.hpp:754
@ SMSG_SPLINE_MOVE_WATER_WALK
Definition Opcodes.hpp:847
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNativeDisplayId()

void Unit::setNativeDisplayId ( uint32_t  id)

Definition at line 1276 of file Unit.cpp.

1276{ write(unitData()->native_display_id, id); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNpcFlags()

void Unit::setNpcFlags ( uint64_t  npcFlags)

Definition at line 1440 of file Unit.cpp.

1440{ write(unitData()->npc_flags, npcFlags); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setOnMeleeSpell()

void Unit::setOnMeleeSpell ( uint32_t  spellId,
uint8_t  ecn = 0 
)
inline

Definition at line 1333 of file Unit.hpp.

1333{ m_meleeSpell = spellId; m_meleeSpell_ecn = ecn; }
Here is the caller graph for this function:

◆ setParryFromSpell()

void Unit::setParryFromSpell ( float  value)
inline

Definition at line 1522 of file Unit.hpp.

Here is the caller graph for this function:

◆ setPetExperience()

void Unit::setPetExperience ( uint32_t  experience)

Definition at line 1408 of file Unit.cpp.

1408{ write(unitData()->pet_experience, experience); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPetFlags()

void Unit::setPetFlags ( uint8_t  petFlags)

Definition at line 1581 of file Unit.cpp.

1581{ write(unitData()->field_bytes_2.s.pet_flag, petFlags); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPetNameTimestamp()

void Unit::setPetNameTimestamp ( uint32_t  timestamp)

Definition at line 1405 of file Unit.cpp.

1405{ write(unitData()->pet_name_timestamp, timestamp); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPetNextLevelExperience()

void Unit::setPetNextLevelExperience ( uint32_t  experience)

Definition at line 1411 of file Unit.cpp.

1411{ write(unitData()->pet_next_level_experience, experience); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPetNumber()

void Unit::setPetNumber ( uint32_t  timestamp)

Definition at line 1402 of file Unit.cpp.

1402{ write(unitData()->pet_number, number); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPhase()

void Unit::setPhase ( uint8_t  command = PHASE_SET,
uint32_t  newPhase = 1 
)
virtual

Reimplemented in Player.

Definition at line 1715 of file Unit.cpp.

1716{
1717 Object::Phase(command, newPhase);
1718
1719 for (const auto& itr : getInRangeObjectsSet())
1720 {
1721 if (itr && itr->isCreatureOrPlayer())
1722 dynamic_cast<Unit*>(itr)->updateVisibility();
1723 }
1724
1726}
virtual void Phase(uint8_t command=PHASE_SET, uint32_t newphase=1)
Definition Object.cpp:4454
void updateVisibility()
Definition Unit.cpp:6244
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPositiveAuraLimit()

void Unit::setPositiveAuraLimit ( uint8_t  limit)

Definition at line 1553 of file Unit.cpp.

1553{ write(unitData()->field_bytes_2.s.positive_aura_limit, limit); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPower()

void Unit::setPower ( PowerType  type,
uint32_t  value,
bool  sendPacket = true,
bool  skipObjectUpdate = false 
)

Definition at line 547 of file Unit.cpp.

548{
549 if (type == POWER_TYPE_HEALTH)
550 {
552 return;
553 }
554
555 const auto maxPower = getMaxPower(type);
556 if (value > maxPower)
557 value = maxPower;
558
559 if (getPower(type) == value)
560 return;
561
562 // Since cata power fields work differently
563 // Get matching power index by power type
564 const auto powerIndex = getPowerIndexFromDBC(type);
565 switch (powerIndex)
566 {
568 write(unitData()->power_1, value, skipObjectUpdate);
569 break;
571 write(unitData()->power_2, value, skipObjectUpdate);
572 break;
574 write(unitData()->power_3, value, skipObjectUpdate);
575 break;
577 write(unitData()->power_4, value, skipObjectUpdate);
578 break;
580 write(unitData()->power_5, value, skipObjectUpdate);
581 break;
582#if VERSION_STRING == WotLK
584 write(unitData()->power_6, value, skipObjectUpdate);
585 break;
587 write(unitData()->power_7, value, skipObjectUpdate);
588 break;
589#endif
590 default:
591 return;
592 }
593
594 if (skipObjectUpdate)
595 return;
596
597#if VERSION_STRING == TBC
598 // TODO Fix this later
599 return;
600#endif
601
602 // Send power update to client
603 if (sendPacket)
605
606 // Update power also to group
607 const auto plr = getPlayerOwnerOrSelf();
608 if (plr == nullptr || !plr->IsInWorld() || plr->getGroup() == nullptr)
609 return;
610
612}
@ GROUP_UPDATE_FLAG_PET_CUR_POWER
Definition Group.h:70
@ GROUP_UPDATE_FLAG_CUR_POWER
Definition Group.h:58
void sendPowerUpdate(bool self)
Definition Unit.cpp:6734
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPowerCostModifier()

void Unit::setPowerCostModifier ( uint16_t  school,
uint32_t  modifier 
)

Definition at line 1603 of file Unit.cpp.

1603{ write(unitData()->power_cost_modifier[school], modifier); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPowerCostMultiplier()

void Unit::setPowerCostMultiplier ( uint16_t  school,
float  multiplier 
)

Definition at line 1616 of file Unit.cpp.

1616{ write(unitData()->power_cost_multiplier[school], multiplier); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPowerRegeneration()

void Unit::setPowerRegeneration ( PowerType  type,
float  value 
)

Definition at line 794 of file Unit.cpp.

795{
796#if VERSION_STRING < WotLK
797 switch (type)
798 {
799 case POWER_TYPE_MANA:
800#if VERSION_STRING == TBC
801 if (isPlayer())
802 dynamic_cast<Player*>(this)->setManaRegeneration(value);
803 else
804#endif
805 m_manaRegeneration = value;
806 break;
807 case POWER_TYPE_RAGE:
808 m_rageRegeneration = value;
809 break;
810 case POWER_TYPE_FOCUS:
811 m_focusRegeneration = value;
812 break;
814 m_energyRegeneration = value;
815 break;
816 default:
817 break;
818 }
819#else
820 if (type == POWER_TYPE_HEALTH)
821 return;
822
823 const auto powerIndex = getPowerIndexFromDBC(type);
824 switch (powerIndex)
825 {
831#if VERSION_STRING == WotLK
834#endif
835 write(unitData()->power_regen_flat_modifier[powerIndex - 1], value);
836 break;
837 default:
838 break;
839 }
840#endif
841}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPowerRegenerationWhileInterrupted()

void Unit::setPowerRegenerationWhileInterrupted ( PowerType  type,
float  value 
)

Definition at line 887 of file Unit.cpp.

888{
889#if VERSION_STRING < WotLK
890 switch (type)
891 {
892 case POWER_TYPE_MANA:
893#if VERSION_STRING == TBC
894 if (isPlayer())
895 dynamic_cast<Player*>(this)->setManaRegenerationWhileCasting(value);
896 else
897#endif
898 m_manaRegenerationWhileCasting = value;
899 break;
900 case POWER_TYPE_RAGE:
901 m_rageRegenerationWhileCombat = value;
902 break;
903 case POWER_TYPE_FOCUS:
904 m_focusRegeneration = value;
905 break;
907 m_energyRegeneration = value;
908 break;
909 default:
910 break;
911 }
912#else
913 if (type == POWER_TYPE_HEALTH)
914 return;
915
916 const auto powerIndex = getPowerIndexFromDBC(type);
917 switch (powerIndex)
918 {
924#if VERSION_STRING == WotLK
927#endif
928 write(unitData()->power_regen_interrupted_flat_modifier[powerIndex - 1], value);
929 break;
930 default:
931 break;
932 }
933#endif
934}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPowerType()

void Unit::setPowerType ( uint8_t  powerType)

Definition at line 463 of file Unit.cpp.

464{
465 write(unitData()->field_bytes_0.s.power_type, powerType);
466
467#if VERSION_STRING == TBC
468 // TODO Fix this later
469 return;
470#endif
471
472 // Update power type also to group
473 const auto plr = getPlayerOwnerOrSelf();
474 if (plr == nullptr || !plr->IsInWorld() || plr->getGroup() == nullptr)
475 return;
476
478}
@ GROUP_UPDATE_FLAG_POWER_TYPE
Definition Group.h:57
@ GROUP_UPDATE_FLAG_PET_POWER_TYPE
Definition Group.h:69
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPvpFlag()

void Unit::setPvpFlag ( )
virtual

Reimplemented in Creature, and Player.

Definition at line 6941 of file Unit.cpp.

6941{}

◆ setRace()

void Unit::setRace ( uint8_t  race)

Definition at line 454 of file Unit.cpp.

454{ write(unitData()->field_bytes_0.s.race, race); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setRangedAttackPower()

void Unit::setRangedAttackPower ( int32_t  power)

Definition at line 1594 of file Unit.cpp.

1594{ write(unitData()->ranged_attack_power, power); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setRangedAttackPowerMods()

void Unit::setRangedAttackPowerMods ( int32_t  modifier)

Definition at line 1672 of file Unit.cpp.

1673{
1674#if VERSION_STRING < Cata
1675 write(unitData()->ranged_attack_power_mods, modifier);
1676#else
1677 write(unitData()->ranged_attack_power_mods_neg, static_cast<uint32_t>(modifier < 0 ? modifier : 0));
1678 write(unitData()->ranged_attack_power_mods_pos, static_cast<uint32_t>(modifier > 0 ? modifier : 0));
1679#endif
1680}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setRangedAttackPowerMultiplier()

void Unit::setRangedAttackPowerMultiplier ( float  multiplier)

Definition at line 1694 of file Unit.cpp.

1694{ write(unitData()->ranged_attack_power_multiplier, multiplier); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setResistance()

void Unit::setResistance ( uint8_t  type,
uint32_t  value 
)

Definition at line 1460 of file Unit.cpp.

1460{ write(unitData()->resistance[type], value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setResistChanceMod()

void Unit::setResistChanceMod ( uint32_t  amount)
inline

Definition at line 1358 of file Unit.hpp.

1358{ m_resistChance = amount; }

◆ setSanctuaryFlag()

void Unit::setSanctuaryFlag ( )
virtual

Reimplemented in Creature, and Player.

Definition at line 6949 of file Unit.cpp.

6949{}

◆ setShapeShiftForm()

void Unit::setShapeShiftForm ( uint8_t  shapeShiftForm)

Definition at line 1387 of file Unit.cpp.

1387{ write(unitData()->field_bytes_1.s.shape_shift_form, shapeShiftForm); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSheathType()

void Unit::setSheathType ( uint8_t  sheathType)

Definition at line 1549 of file Unit.cpp.

1549{ write(unitData()->field_bytes_2.s.sheath_type, sheathType); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSingleTargetGuidForAura()

void Unit::setSingleTargetGuidForAura ( uint32_t  spellId,
uint64_t  guid 
)

Definition at line 5514 of file Unit.cpp.

5515{
5516 auto itr = m_singleTargetAura.find(spellId);
5517
5518 if (itr != m_singleTargetAura.end())
5519 itr->second = guid;
5520 else
5521 m_singleTargetAura.insert(std::make_pair(spellId, guid));
5522}
Here is the caller graph for this function:

◆ setSpeedRate()

void Unit::setSpeedRate ( UnitSpeedType  mtype,
float  rate,
bool  current 
)

Definition at line 2668 of file Unit.cpp.

2669{
2670 if (value < 0)
2671 value = 0.0f;
2672
2673 // Update speed only on change
2675 return;
2676
2677 if (current)
2679 else
2681
2682 // Update Also For Movement Generators
2684
2685 if (auto* const plr = isPlayer() ? dynamic_cast<Player*>(this) : nullptr)
2686 {
2687 // register forced speed changes for WorldSession::HandleForceSpeedChangeAck
2688 // and do it only for real sent packets and use run for run/mounted as client expected
2689 ++plr->m_forced_speed_changes[type];
2690
2691 if (!isInCombat())
2692 plr->getSummonInterface()->notifyOnOwnerSpeedChange(type, m_UnitSpeedInfo.m_currentSpeedRate[type], false);
2693 }
2694
2695 WorldPacket data;
2696 ObjectGuid guid = getGuid();
2697
2698 switch (type)
2699 {
2700 case TYPE_WALK:
2701 data.Initialize(SMSG_SPLINE_SET_WALK_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
2702 data.writeBit(guid[0]);
2703 data.writeBit(guid[6]);
2704 data.writeBit(guid[7]);
2705 data.writeBit(guid[3]);
2706 data.writeBit(guid[5]);
2707 data.writeBit(guid[1]);
2708 data.writeBit(guid[2]);
2709 data.writeBit(guid[4]);
2710 data.flushBits();
2711 data.WriteByteSeq(guid[0]);
2712 data.WriteByteSeq(guid[4]);
2713 data.WriteByteSeq(guid[7]);
2714 data.WriteByteSeq(guid[1]);
2715 data.WriteByteSeq(guid[5]);
2716 data.WriteByteSeq(guid[3]);
2717 data << float(value);
2718 data.WriteByteSeq(guid[2]);
2719 data.WriteByteSeq(guid[5]);
2720 break;
2721 case TYPE_RUN:
2722 data.Initialize(SMSG_SPLINE_SET_RUN_SPEED, 1 + 8 + 4);
2723 data.writeBit(guid[4]);
2724 data.writeBit(guid[0]);
2725 data.writeBit(guid[5]);
2726 data.writeBit(guid[7]);
2727 data.writeBit(guid[6]);
2728 data.writeBit(guid[3]);
2729 data.writeBit(guid[1]);
2730 data.writeBit(guid[2]);
2731 data.flushBits();
2732 data.WriteByteSeq(guid[0]);
2733 data.WriteByteSeq(guid[7]);
2734 data.WriteByteSeq(guid[6]);
2735 data.WriteByteSeq(guid[5]);
2736 data.WriteByteSeq(guid[3]);
2737 data.WriteByteSeq(guid[4]);
2738 data << float(value);
2739 data.WriteByteSeq(guid[2]);
2740 data.WriteByteSeq(guid[1]);
2741 break;
2742 case TYPE_RUN_BACK:
2744 data.writeBit(guid[1]);
2745 data.writeBit(guid[2]);
2746 data.writeBit(guid[6]);
2747 data.writeBit(guid[0]);
2748 data.writeBit(guid[3]);
2749 data.writeBit(guid[7]);
2750 data.writeBit(guid[5]);
2751 data.writeBit(guid[4]);
2752 data.flushBits();
2753 data.WriteByteSeq(guid[1]);
2754 data << float(value);
2755 data.WriteByteSeq(guid[2]);
2756 data.WriteByteSeq(guid[4]);
2757 data.WriteByteSeq(guid[0]);
2758 data.WriteByteSeq(guid[3]);
2759 data.WriteByteSeq(guid[6]);
2760 data.WriteByteSeq(guid[5]);
2761 data.WriteByteSeq(guid[7]);
2762 break;
2763 case TYPE_SWIM:
2764 data.Initialize(SMSG_SPLINE_SET_SWIM_SPEED, 1 + 8 + 4);
2765 data.writeBit(guid[4]);
2766 data.writeBit(guid[2]);
2767 data.writeBit(guid[5]);
2768 data.writeBit(guid[0]);
2769 data.writeBit(guid[7]);
2770 data.writeBit(guid[6]);
2771 data.writeBit(guid[3]);
2772 data.writeBit(guid[1]);
2773 data.flushBits();
2774 data.WriteByteSeq(guid[5]);
2775 data.WriteByteSeq(guid[6]);
2776 data.WriteByteSeq(guid[1]);
2777 data.WriteByteSeq(guid[0]);
2778 data.WriteByteSeq(guid[2]);
2779 data.WriteByteSeq(guid[4]);
2780 data << float(value);
2781 data.WriteByteSeq(guid[7]);
2782 data.WriteByteSeq(guid[3]);
2783 break;
2784 case TYPE_SWIM_BACK:
2786 data.writeBit(guid[0]);
2787 data.writeBit(guid[1]);
2788 data.writeBit(guid[3]);
2789 data.writeBit(guid[6]);
2790 data.writeBit(guid[4]);
2791 data.writeBit(guid[5]);
2792 data.writeBit(guid[7]);
2793 data.writeBit(guid[2]);
2794 data.flushBits();
2795 data.WriteByteSeq(guid[5]);
2796 data.WriteByteSeq(guid[3]);
2797 data.WriteByteSeq(guid[1]);
2798 data.WriteByteSeq(guid[0]);
2799 data.WriteByteSeq(guid[7]);
2800 data.WriteByteSeq(guid[6]);
2801 data << float(value);
2802 data.WriteByteSeq(guid[4]);
2803 data.WriteByteSeq(guid[2]);
2804 break;
2805 case TYPE_TURN_RATE:
2806 data.Initialize(SMSG_SPLINE_SET_TURN_RATE, 1 + 8 + 4);
2807 data.writeBit(guid[2]);
2808 data.writeBit(guid[4]);
2809 data.writeBit(guid[6]);
2810 data.writeBit(guid[1]);
2811 data.writeBit(guid[3]);
2812 data.writeBit(guid[5]);
2813 data.writeBit(guid[7]);
2814 data.writeBit(guid[0]);
2815 data.flushBits();
2816 data << float(value);
2817 data.WriteByteSeq(guid[1]);
2818 data.WriteByteSeq(guid[5]);
2819 data.WriteByteSeq(guid[3]);
2820 data.WriteByteSeq(guid[2]);
2821 data.WriteByteSeq(guid[7]);
2822 data.WriteByteSeq(guid[4]);
2823 data.WriteByteSeq(guid[6]);
2824 data.WriteByteSeq(guid[0]);
2825 break;
2826 case TYPE_FLY:
2828 data.writeBit(guid[7]);
2829 data.writeBit(guid[4]);
2830 data.writeBit(guid[0]);
2831 data.writeBit(guid[1]);
2832 data.writeBit(guid[3]);
2833 data.writeBit(guid[6]);
2834 data.writeBit(guid[5]);
2835 data.writeBit(guid[2]);
2836 data.flushBits();
2837 data.WriteByteSeq(guid[0]);
2838 data.WriteByteSeq(guid[5]);
2839 data.WriteByteSeq(guid[4]);
2840 data.WriteByteSeq(guid[7]);
2841 data.WriteByteSeq(guid[3]);
2842 data.WriteByteSeq(guid[2]);
2843 data.WriteByteSeq(guid[1]);
2844 data.WriteByteSeq(guid[6]);
2845 data << float(value);
2846 break;
2847 case TYPE_FLY_BACK:
2849 data.writeBit(guid[2]);
2850 data.writeBit(guid[1]);
2851 data.writeBit(guid[6]);
2852 data.writeBit(guid[5]);
2853 data.writeBit(guid[0]);
2854 data.writeBit(guid[3]);
2855 data.writeBit(guid[4]);
2856 data.writeBit(guid[7]);
2857 data.flushBits();
2858 data.WriteByteSeq(guid[5]);
2859 data << float(value);
2860 data.WriteByteSeq(guid[6]);
2861 data.WriteByteSeq(guid[1]);
2862 data.WriteByteSeq(guid[0]);
2863 data.WriteByteSeq(guid[2]);
2864 data.WriteByteSeq(guid[3]);
2865 data.WriteByteSeq(guid[7]);
2866 data.WriteByteSeq(guid[4]);
2867 break;
2868 case TYPE_PITCH_RATE:
2869 data.Initialize(SMSG_SPLINE_SET_PITCH_RATE, 1 + 8 + 4);
2870 data.writeBit(guid[3]);
2871 data.writeBit(guid[5]);
2872 data.writeBit(guid[6]);
2873 data.writeBit(guid[1]);
2874 data.writeBit(guid[0]);
2875 data.writeBit(guid[4]);
2876 data.writeBit(guid[7]);
2877 data.writeBit(guid[2]);
2878 data.flushBits();
2879 data.WriteByteSeq(guid[1]);
2880 data.WriteByteSeq(guid[5]);
2881 data.WriteByteSeq(guid[7]);
2882 data.WriteByteSeq(guid[0]);
2883 data.WriteByteSeq(guid[6]);
2884 data.WriteByteSeq(guid[3]);
2885 data.WriteByteSeq(guid[2]);
2886 data << float(value);
2887 data.WriteByteSeq(guid[4]);
2888 break;
2889 default:
2890 sLogger.failure("Unit::setSpeedRate: Unsupported move type ({}), data not sent to client.", type);
2891 return;
2892 }
2893
2894 sendMessageToSet(&data, true);
2895}
void flushBits()
Definition ByteBuffer.h:93
void WriteByteSeq(uint8_t b)
Definition ByteBuffer.h:182
bool writeBit(uint32_t bit)
Definition ByteBuffer.h:103
void propagateSpeedChange()
Definition Unit.cpp:2903
void Initialize(uint16_t opcode, size_t newres=200)
Definition WorldPacket.h:20
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setStandState()

void Unit::setStandState ( uint8_t  standState)

Definition at line 1366 of file Unit.cpp.

1367{
1368 write(unitData()->field_bytes_1.s.stand_state, standState);
1369
1370 if (isPlayer())
1371 dynamic_cast<Player*>(this)->sendPacket(SmsgStandStateUpdate(standState).serialise().get());
1372
1373 if (standState != STANDSTATE_SIT)
1375}
Here is the call graph for this function:

◆ setStandStateFlags()

void Unit::setStandStateFlags ( uint8_t  standStateFlags)

Definition at line 1391 of file Unit.cpp.

1391{ write(unitData()->field_bytes_1.s.stand_state_flag, standStateFlags); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setStat()

void Unit::setStat ( uint8_t  stat,
uint32_t  value 
)

Definition at line 1449 of file Unit.cpp.

1449{ write(unitData()->stat[stat], value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setStunned()

void Unit::setStunned ( bool  apply)
protected

Definition at line 3097 of file Unit.cpp.

3098{
3099 if (apply)
3100 {
3101 setTargetGuid(0);
3103
3104 // MOVEMENTFLAG_ROOT cannot be used in conjunction with MOVEMENTFLAG_MASK_MOVING (tested 3.3.5a)
3105 // this will freeze clients. That's why we remove MOVEMENTFLAG_MASK_MOVING before
3106 // setting MOVEMENTFLAG_ROOT
3109 stopMoving();
3110
3111 if (isPlayer())
3112 {
3114
3116 data << GetNewGUID();
3117 data << 0;
3118 sendMessageToSet(&data, true);
3119 }
3120 else
3121 {
3123 data << 0;
3124 sendMessageToSet(&data, true);
3125 }
3126 }
3127 else
3128 {
3129 if (isAlive() && getThreatManager().getCurrentVictim())
3130 setTargetGuid(getThreatManager().getCurrentVictim()->getGuid());
3131
3132 // don't remove UNIT_FLAG_STUNNED for pet when owner is mounted (disabled pet's interface)
3133 Player* owner = getPlayerOwner();
3134 if (!owner || !owner->isMounted())
3136
3137 if (!hasUnitStateFlag(UNIT_STATE_ROOTED)) // prevent moving if it also has root effect
3138 {
3139 if (isPlayer())
3140 {
3142 data << GetNewGUID();
3143 data << 0;
3144 sendMessageToSet(&data, true);
3145 }
3146 else
3147 {
3149 data << GetNewGUID();
3150 sendMessageToSet(&data, true);
3151 }
3152
3154 }
3155 }
3156}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSummonedByGuid()

void Unit::setSummonedByGuid ( uint64_t  guid)

Definition at line 395 of file Unit.cpp.

395{ write(unitData()->summoned_by_guid.guid, guid); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSummonGuid()

void Unit::setSummonGuid ( uint64_t  guid)

Definition at line 384 of file Unit.cpp.

384{ write(unitData()->summon_guid.guid, guid); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTaggerGuid()

void Unit::setTaggerGuid ( Unit const tagger)

Definition at line 8103 of file Unit.cpp.

8104{
8105 if (tagger != nullptr)
8106 {
8107 this->m_taggerGuid = tagger->getGuid();
8108 m_taggedBySummon = tagger->isSummon();
8109 if (!m_taggedBySummon)
8111 }
8112 else
8113 {
8114 this->m_taggerGuid = 0;
8115 m_taggedBySummon = false;
8117 }
8118}
void removeDynamicFlags(uint16_t dynamicFlags)
Definition Object.cpp:396
void addDynamicFlags(uint16_t dynamicFlags)
Definition Object.cpp:395
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTargetGuid()

void Unit::setTargetGuid ( uint64_t  guid)

Definition at line 401 of file Unit.cpp.

401{ write(unitData()->target_guid.guid, guid); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTransformAura()

void Unit::setTransformAura ( uint32_t  auraId)

Definition at line 5566 of file Unit.cpp.

5567{
5568 m_transformAura = auraId;
5569}
Here is the caller graph for this function:

◆ setTriggerChill()

void Unit::setTriggerChill ( uint32_t  newTrigger,
uint32_t  newChance,
bool  isVictim = false 
)

Definition at line 9171 of file Unit.cpp.

9172{
9173 if (isVictim == false)
9174 {
9175 m_triggerOnChill = newTrigger;
9176 m_triggerOnChillChance = newChance;
9177 }
9178 else
9179 {
9180 m_triggerOnChillVictim = newTrigger;
9181 m_triggerOnChillChanceVictim = newChance;
9182 }
9183}
Here is the caller graph for this function:

◆ setTriggerStunOrImmobilize()

void Unit::setTriggerStunOrImmobilize ( uint32_t  newTrigger,
uint32_t  newChance,
bool  isVictim = false 
)

Definition at line 9115 of file Unit.cpp.

9116{
9117 if (isVictim == false)
9118 {
9119 m_triggerOnStun = newTrigger;
9120 m_triggerOnStunChance = newChance;
9121 }
9122 else
9123 {
9124 m_triggerOnStunVictim = newTrigger;
9125 m_triggerOnStunChanceVictim = newChance;
9126 }
9127}
Here is the caller graph for this function:

◆ setUnitFlags()

void Unit::setUnitFlags ( uint32_t  unitFlags)

Definition at line 1108 of file Unit.cpp.

1108{ write(unitData()->unit_flags, unitFlags); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setUnitMovementFlags()

void Unit::setUnitMovementFlags ( uint32_t  f)

Definition at line 1934 of file Unit.cpp.

1934{ obj_movement_info.flags = f; }
Here is the caller graph for this function:

◆ setVirtualItemSlotId()

void Unit::setVirtualItemSlotId ( uint8_t  slot,
uint32_t  item_id 
)

Definition at line 965 of file Unit.cpp.

966{
967 const auto isProperOffhandWeapon = [](uint32_t itemClass, uint32_t itemSubClass) -> bool
968 {
969 if (itemClass != ITEM_CLASS_WEAPON)
970 return false;
971
972 switch (itemSubClass)
973 {
979 return false;
980 default:
981 break;
982 }
983
984 return true;
985 };
986
987 if (item_id == 0)
988 {
989 write(unitData()->virtual_item_slot_display[slot], 0U);
990#if VERSION_STRING < WotLK
991 setVirtualItemInfo(slot, 0);
992#endif
993
994 if (isCreature())
995 {
996#if VERSION_STRING < WotLK
997 dynamic_cast<Creature*>(this)->setVirtualItemEntry(slot, 0);
998#endif
999 if (slot == OFFHAND)
1000 dynamic_cast<Creature*>(this)->toggleDualwield(false);
1001 }
1002 return;
1003 }
1004
1005#if VERSION_STRING >= WotLK
1006 const auto itemDbc = sItemStore.lookupEntry(item_id);
1007 if (itemDbc == nullptr
1008 || !(itemDbc->Class == ITEM_CLASS_WEAPON
1009 || (itemDbc->Class == ITEM_CLASS_ARMOR && itemDbc->SubClass == ITEM_SUBCLASS_ARMOR_SHIELD)
1010 || itemDbc->InventoryType == INVTYPE_HOLDABLE))
1011 return;
1012
1013 if (isCreature() && slot == OFFHAND)
1014 dynamic_cast<Creature*>(this)->toggleDualwield(isProperOffhandWeapon(itemDbc->Class, itemDbc->SubClass));
1015
1016 write(unitData()->virtual_item_slot_display[slot], item_id);
1017#else
1018 unit_virtual_item_info virtualItemInfo{};
1019
1020 uint32_t displayId = 0;
1021 virtualItemInfo.fields.item_class = 0;
1022 virtualItemInfo.fields.item_subclass = 0;
1023 // Seems to be always -1
1024 virtualItemInfo.fields.unk0 = -1;
1025 virtualItemInfo.fields.material = 0;
1026 virtualItemInfo.fields.inventory_type = 0;
1027 virtualItemInfo.fields.sheath = 0;
1028 if (const auto itemProperties = sMySQLStore.getItemProperties(item_id))
1029 {
1030 displayId = itemProperties->DisplayInfoID;
1031 virtualItemInfo.fields.item_class = static_cast<uint8_t>(itemProperties->Class);
1032 virtualItemInfo.fields.item_subclass = static_cast<uint8_t>(itemProperties->SubClass);
1033 virtualItemInfo.fields.material = static_cast<uint8_t>(itemProperties->LockMaterial);
1034 virtualItemInfo.fields.inventory_type = static_cast<uint8_t>(itemProperties->InventoryType);
1035 virtualItemInfo.fields.sheath = static_cast<uint8_t>(itemProperties->SheathID);
1036 }
1037 else if (const auto itemDbc = sItemStore.lookupEntry(item_id))
1038 {
1039 displayId = itemDbc->DisplayId;
1040 virtualItemInfo.fields.inventory_type = static_cast<uint8_t>(itemDbc->InventoryType);
1041 virtualItemInfo.fields.sheath = static_cast<uint8_t>(itemDbc->Sheath);
1042
1043 // Following values do not exist in dbcs and must be "hackfixed"
1044 virtualItemInfo.fields.material = ITEM_MATERIAL_METAL;
1045 switch (virtualItemInfo.fields.inventory_type)
1046 {
1047 case INVTYPE_WEAPON:
1050 virtualItemInfo.fields.item_class = ITEM_CLASS_WEAPON;
1051 virtualItemInfo.fields.item_subclass = ITEM_SUBCLASS_WEAPON_SWORD;
1052 break;
1053 case INVTYPE_SHIELD:
1054 virtualItemInfo.fields.item_class = ITEM_CLASS_ARMOR;
1055 virtualItemInfo.fields.item_subclass = ITEM_SUBCLASS_ARMOR_SHIELD;
1056 break;
1057 case INVTYPE_RANGED:
1058 virtualItemInfo.fields.item_class = ITEM_CLASS_WEAPON;
1059 virtualItemInfo.fields.item_subclass = ITEM_SUBCLASS_WEAPON_BOW;
1060 break;
1062 virtualItemInfo.fields.item_class = ITEM_CLASS_WEAPON;
1063 virtualItemInfo.fields.item_subclass = ITEM_SUBCLASS_WEAPON_GUN;
1064 break;
1065 case INVTYPE_2HWEAPON:
1066 virtualItemInfo.fields.item_class = ITEM_CLASS_WEAPON;
1067 if (virtualItemInfo.fields.sheath == ITEM_SHEATH_STAFF)
1068 virtualItemInfo.fields.item_subclass = ITEM_SUBCLASS_WEAPON_STAFF;
1069 else
1070 virtualItemInfo.fields.item_subclass = ITEM_SUBCLASS_WEAPON_TWOHAND_SWORD;
1071 break;
1072 case INVTYPE_HOLDABLE:
1073 virtualItemInfo.fields.item_class = ITEM_CLASS_MISCELLANEOUS;
1074 virtualItemInfo.fields.item_subclass = ITEM_SUBCLASS_MISC_JUNK;
1075 break;
1076 case INVTYPE_THROWN:
1077 virtualItemInfo.fields.item_class = ITEM_CLASS_WEAPON;
1078 virtualItemInfo.fields.item_subclass = ITEM_SUBCLASS_WEAPON_THROWN;
1079 break;
1080 default:
1081 return;
1082 }
1083 }
1084 else
1085 {
1086 return;
1087 }
1088
1089 if (isCreature())
1090 {
1091 dynamic_cast<Creature*>(this)->setVirtualItemEntry(slot, item_id);
1092 if (slot == OFFHAND)
1093 dynamic_cast<Creature*>(this)->toggleDualwield(isProperOffhandWeapon(virtualItemInfo.fields.item_class, virtualItemInfo.fields.item_subclass));
1094 }
1095
1096 write(unitData()->virtual_item_slot_display[slot], displayId);
1097 setVirtualItemInfo(slot, virtualItemInfo.raw);
1098#endif
1099}
@ ITEM_MATERIAL_METAL
@ ITEM_CLASS_ARMOR
@ ITEM_CLASS_MISCELLANEOUS
@ ITEM_CLASS_WEAPON
@ ITEM_SHEATH_STAFF
@ ITEM_SUBCLASS_WEAPON_CROSSBOW
@ ITEM_SUBCLASS_WEAPON_GUN
@ ITEM_SUBCLASS_WEAPON_STAFF
@ ITEM_SUBCLASS_MISC_JUNK
@ ITEM_SUBCLASS_ARMOR_SHIELD
@ ITEM_SUBCLASS_WEAPON_BOW
@ ITEM_SUBCLASS_WEAPON_SWORD
@ ITEM_SUBCLASS_WEAPON_WAND
@ ITEM_SUBCLASS_WEAPON_THROWN
@ ITEM_SUBCLASS_WEAPON_TWOHAND_SWORD
@ INVTYPE_HOLDABLE
@ INVTYPE_RANGED
@ INVTYPE_THROWN
@ INVTYPE_RANGEDRIGHT
@ INVTYPE_WEAPONMAINHAND
@ INVTYPE_WEAPONOFFHAND
@ INVTYPE_2HWEAPON
@ INVTYPE_SHIELD
SERVER_DECL WDB::WDBContainer< WDB::Structures::ItemEntry > sItemStore
void toggleDualwield(bool)
Definition Creature.cpp:445
struct unit_virtual_item_info::parts fields
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setVisible()

void Unit::setVisible ( const bool  visible)

Definition at line 6235 of file Unit.cpp.

6236{
6237 if (!visible)
6239 else
6242}
int32_t getInvisibilityLevel(InvisibilityFlag flag) const
Definition Unit.cpp:6210
void modInvisibilityLevel(InvisibilityFlag flag, const int32_t amount)
Definition Unit.cpp:6220
Here is the call graph for this function:
Here is the caller graph for this function:

◆ smsg_AttackStart()

void Unit::smsg_AttackStart ( Unit pVictim)

Definition at line 7541 of file Unit.cpp.

7542{
7543 sendMessageToSet(SmsgAttackStart(getGuid(), pVictim->getGuid()).serialise().get(), false);
7544
7545 sLogger.debug("WORLD: Sent SMSG_ATTACK_START");
7546
7547 if (isPlayer())
7548 {
7549 Player* player = dynamic_cast<Player*>(this);
7550 if (player->m_cannibalize)
7551 {
7552 sEventMgr.RemoveEvents(player, EVENT_CANNIBALIZE);
7554 player->m_cannibalize = false;
7555 }
7556 }
7557}
@ EVENT_CANNIBALIZE
Definition EventMgr.h:48
@ EMOTE_ONESHOT_NONE
bool m_cannibalize
Definition Player.hpp:2095
Here is the call graph for this function:
Here is the caller graph for this function:

◆ smsg_AttackStop()

void Unit::smsg_AttackStop ( Unit pVictim)

Definition at line 7533 of file Unit.cpp.

7534{
7535 if (pVictim)
7536 sendMessageToSet(SmsgAttackStop(GetNewGUID(), pVictim->GetNewGUID()).serialise().get(), true);
7537 else
7538 sendMessageToSet(SmsgAttackStop(GetNewGUID(), WoWGuid()).serialise().get(), true);
7539}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stopMoving()

void Unit::stopMoving ( )

Definition at line 2998 of file Unit.cpp.

2999{
3001
3002 // not need send any packets if not in world or not moving
3003 if (!IsInWorld() || movespline->Finalized())
3004 return;
3005
3006 // Update position now since Stop does not start a new movement that can be updated later
3007 if (movespline->HasStarted())
3010 init.Stop();
3011}
@ UNIT_STATE_MOVING
void updateSplinePosition()
Definition Unit.cpp:3195
Here is the call graph for this function:

◆ strike()

DamageInfo Unit::strike ( Unit pVictim,
WeaponDamageType  weaponType,
SpellInfo const ability,
int32_t  add_damage,
int32_t  pct_dmg_mod,
uint32_t  exclusive_damage,
bool  disable_proc,
bool  skip_hit_check,
bool  force_crit = false,
Spell castingSpell = nullptr 
)
Todo:
different bosses have different parry rates (db patch?)
Todo:
this is wrong
Todo:
add shield check/block chance here how do we check what the creature has equipped?

\ todo: this is inaccurate and almost directly copied here from few lines below

Definition at line 10407 of file Unit.cpp.

10408{
10409 //////////////////////////////////////////////////////////////////////////////////////////
10410 //Unacceptable Cases Processing
10411 if (!pVictim || !pVictim->isAlive() || !isAlive() || isStunned() || isPacified() || isFeared())
10412 return DamageInfo();
10413
10414 if (!isInFront(pVictim))
10415 {
10416 const auto spellTargetMask = ability != nullptr ? ability->getRequiredTargetMask(true) : 0;
10417 if (!(ability && ability->getAttributesEx() & ATTRIBUTESEX_IGNORE_IN_FRONT) && !(spellTargetMask & SPELL_TARGET_AREA_MASK))
10418 {
10419#if VERSION_STRING < Mop
10420 if (isPlayer())
10421 dynamic_cast<Player*>(this)->sendPacket(SmsgAttackSwingBadFacing().serialise().get());
10422#endif
10423
10424 return DamageInfo();
10425 }
10426 }
10427
10428 //////////////////////////////////////////////////////////////////////////////////////////
10429 //Variables Initialization
10430 DamageInfo dmg = DamageInfo();
10431 dmg.weaponType = weaponType;
10432
10433 Item* it = NULL;
10434
10435 float hitchance = 0.0f;
10436 float dodge = 0.0f;
10437 float parry = 0.0f;
10438 float glanc = 0.0f;
10439 float block = 0.0f;
10440 float crit = 0.0f;
10441 float crush = 0.0f;
10442
10443 uint32_t targetEvent = 0;
10444 uint32_t hit_status = HITSTATUS_NORMALSWING;
10445
10447
10448 float hitmodifier = 0;
10449 float ArmorPctReduce = m_ignoreArmorPct;
10450 int32_t self_skill;
10451 int32_t victim_skill = 0;
10452 uint16_t SubClassSkill = SKILL_UNARMED;
10453
10454 bool backAttack = !pVictim->isInFront(this);
10455 uint32_t vskill = 0;
10456 bool disable_dR = false;
10457
10458 if (ability)
10459 dmg.schoolMask = static_cast<SchoolMask>(ability->getSchoolMask());
10460 else
10461 {
10462 if (isCreature())
10463 dmg.schoolMask = static_cast<SchoolMask>(g_spellSchoolConversionTable[static_cast<Creature*>(this)->BaseAttackType]);
10464 else
10466 }
10467
10468#if VERSION_STRING >= TBC // support classic
10469 //////////////////////////////////////////////////////////////////////////////////////////
10470 //Victim Skill Base Calculation
10471 if (pVictim->isPlayer())
10472 {
10473 Player* plr = static_cast<Player*>(pVictim);
10474 vskill = plr->getSkillLineCurrent(SKILL_DEFENSE);
10475
10476 if (!backAttack)
10477 {
10478 // not an attack from behind so we may dodge/parry/block
10479
10480 //uint32_t pClass = plr->getClass();
10481 //uint32_t pLevel = (getLevel()> DBC_PLAYER_LEVEL_CAP) ? DBC_PLAYER_LEVEL_CAP : getLevel();
10482
10483 if (dmg.weaponType != RANGED)
10484 {
10485 // cannot dodge/parry ranged attacks
10486
10487 if (pVictim->m_stunned <= 0)
10488 {
10489 // can dodge as long as we're not stunned
10490 dodge = plr->getDodgeChance();
10491 }
10492
10493 if (pVictim->m_canParry && !m_isDisarmed)
10494 {
10495 // can parry as long as we're not disarmed
10496 parry = plr->getParryChance();
10497 }
10498 }
10499 // can block ranged attacks
10500
10501 // Is an offhand equipped and is it a shield?
10503 if (it2 != nullptr && it2->getItemProperties()->InventoryType == INVTYPE_SHIELD)
10504 {
10505 block = plr->getBlockChance();
10506 }
10507 }
10508 victim_skill = Util::float2int32(vskill + floorf(plr->calcRating(CR_DEFENSE_SKILL)));
10509 }
10510
10511 //////////////////////////////////////////////////////////////////////////////////////////
10512 //mob defensive chances
10513 else
10514 {
10515 // not a player, must be a creature
10516 Creature* c = static_cast<Creature*>(pVictim);
10517
10518 // mobs can dodge attacks from behind
10519 if (dmg.weaponType != RANGED && pVictim->m_stunned <= 0)
10520 {
10521 dodge = pVictim->getStat(STAT_AGILITY) / 14.5f;
10522 dodge += pVictim->getDodgeFromSpell();
10523 }
10524
10525 if (!backAttack)
10526 {
10527 // can parry attacks from the front
10528 ///\todo different bosses have different parry rates (db patch?)
10529 if (!m_isDisarmed) ///\todo this is wrong
10530 {
10531 parry = c->GetBaseParry();
10532 parry += pVictim->getParryFromSpell();
10533 }
10534
10535 ///\todo add shield check/block chance here how do we check what the creature has equipped?
10536 }
10537
10538 victim_skill = pVictim->getLevel() * 5;
10539 if (pVictim->isCreature())
10540 {
10542 {
10543 victim_skill = std::max(victim_skill, (static_cast<int32_t>(getLevel()) + 3) * 5); //used max to avoid situation when lowlvl hits boss.
10544 }
10545 }
10546 }
10547#endif
10548
10549 //////////////////////////////////////////////////////////////////////////////////////////
10550 //Attacker Skill Base Calculation
10551 if (this->isPlayer())
10552 {
10553 self_skill = 0;
10554 Player* pr = static_cast<Player*>(this);
10555 hitmodifier = pr->getHitFromMeleeSpell();
10556
10557 switch (dmg.weaponType)
10558 {
10559 case MELEE: // melee main hand weapon
10562 if (it)
10563 {
10566 ArmorPctReduce += m_ignoreArmorPctMaceSpec;
10567 }
10568 break;
10569 case OFFHAND: // melee offhand weapon (dualwield)
10572 hit_status |= HITSTATUS_DUALWIELD;//animation
10573 if (it)
10574 {
10577 ArmorPctReduce += m_ignoreArmorPctMaceSpec;
10578 }
10579 break;
10580 case RANGED: // ranged weapon
10583 if (it)
10585 break;
10586 }
10587
10588 if (it)
10589 {
10590 SubClassSkill = it->getRequiredSkill();
10591 if (SubClassSkill == SKILL_FIST_WEAPONS)
10592 SubClassSkill = SKILL_UNARMED;
10593 }
10594 else
10595 SubClassSkill = SKILL_UNARMED;
10596
10597
10598 //chances in feral form don't depend on weapon skill
10599 if (pr->isInFeralForm())
10600 {
10601 uint8_t form = pr->getShapeShiftForm();
10602 if (form == FORM_CAT || form == FORM_BEAR || form == FORM_DIREBEAR)
10603 {
10604#if VERSION_STRING <= Cata
10605 SubClassSkill = SKILL_FERAL_COMBAT;
10606#endif
10607 self_skill += pr->getLevel() * 5;
10608 }
10609 }
10610
10611 self_skill += pr->getSkillLineCurrent(SubClassSkill);
10612 crit = static_cast<Player*>(this)->getMeleeCritPercentage();
10613 }
10614 else
10615 {
10616 self_skill = this->getLevel() * 5;
10617 if (isCreature())
10618 {
10619 Creature* c = static_cast<Creature*>(this);
10621 self_skill = std::max(self_skill, (static_cast<int32_t>(pVictim->getLevel()) + 3) * 5); //used max to avoid situation when lowlvl hits boss.
10622 }
10623 crit = 5.0f; //will be modified later
10624
10625 if (dmg.weaponType == OFFHAND)
10626 hit_status |= HITSTATUS_DUALWIELD;
10627 }
10628 //////////////////////////////////////////////////////////////////////////////////////////
10629 //Special Chances Base Calculation
10630
10631 // crushing blow chance
10632 //http://www.wowwiki.com/Crushing_blow
10633 if (pVictim->isPlayer() && !this->isPlayer() && !ability && dmg.schoolMask == SCHOOL_MASK_NORMAL)
10634 {
10635 int32_t baseDefense = static_cast<Player*>(pVictim)->getSkillLineCurrent(SKILL_DEFENSE, false);
10636 int32_t skillDiff = self_skill - baseDefense;
10637 if (skillDiff >= 15)
10638 crush = -15.0f + 2.0f * skillDiff;
10639 else
10640 crush = 0.0f;
10641 }
10642
10643 // glancing blow chance
10644 //http://www.wowwiki.com/Glancing_blow
10645 // did my own quick research here, seems base glancing against equal level mob is about 5%
10646 // and goes up 5% each level. Need to check this further.
10647 float diffAcapped = victim_skill - std::min(static_cast<float>(self_skill), getLevel() * 5.0f);
10648
10649 if (this->isPlayer() && !pVictim->isPlayer() && !ability)
10650 {
10651 glanc = 5.0f + diffAcapped;
10652
10653 if (glanc < 0)
10654 glanc = 0.0f;
10655 }
10656
10657 //////////////////////////////////////////////////////////////////////////////////////////
10658 //Advanced Chances Modifications
10659 // by talents
10660 if (pVictim->isPlayer())
10661 {
10662 if (dmg.weaponType != RANGED)
10663 {
10664 crit += static_cast<Player*>(pVictim)->getResistMCrit();
10665 hitmodifier += static_cast<Player*>(pVictim)->m_resistHit[MOD_MELEE];
10666 }
10667 else
10668 {
10669 crit += static_cast<Player*>(pVictim)->getResistRCrit(); //this could be ability but in that case we overwrite the value
10670 hitmodifier += static_cast<Player*>(pVictim)->m_resistHit[MOD_RANGED];
10671 }
10672 }
10673 crit += static_cast<float>(pVictim->m_attackerCritChanceMod[0]);
10674
10675 // by skill difference
10676 float vsk = static_cast<float>(self_skill - victim_skill);
10677 dodge = std::max(0.0f, dodge - vsk * 0.04f);
10678
10679 if (parry)
10680 parry = std::max(0.0f, parry - vsk * 0.04f);
10681
10682 if (block)
10683 block = std::max(0.0f, block - vsk * 0.04f);
10684
10685 crit += pVictim->isPlayer() ? vsk * 0.04f : std::min(vsk * 0.2f, 0.0f);
10686
10687 // http://www.wowwiki.com/Miss
10688 float misschance;
10689 float ask = -vsk;
10690
10691 if (pVictim->isPlayer())
10692 {
10693 if (ask > 0)
10694 misschance = ask * 0.04f;
10695 else
10696 misschance = ask * 0.02f;
10697 }
10698 else
10699 {
10700 if (ask <= 10)
10701 misschance = (ask * 0.1f);
10702 else
10703 misschance = (2 + (ask - 10) * 0.4f);
10704 }
10705 hitchance = 100.0f - misschance; // base miss chances are worked out further down
10706
10707 if (ability != nullptr && castingSpell != nullptr)
10708 {
10709 applySpellModifiers(SPELLMOD_CRITICAL, &crit, ability, castingSpell);
10710 if (!skip_hit_check)
10711 applySpellModifiers(SPELLMOD_HITCHANCE, &hitchance, ability, castingSpell);
10712 }
10713
10714 // by ratings
10715#if VERSION_STRING >= Cata
10716 crit -= pVictim->isPlayer() ? static_cast<Player*>(pVictim)->calcRating(CR_RESILIENCE_CRIT_TAKEN) : 0.0f;
10717#else
10718 crit -= pVictim->isPlayer() ? static_cast<Player*>(pVictim)->calcRating(CR_CRIT_TAKEN_MELEE) : 0.0f;
10719#endif
10720
10721 if (crit < 0)
10722 crit = 0.0f;
10723
10724 if (this->isPlayer())
10725 {
10726 Player* plr = static_cast<Player*>(this);
10727 hitmodifier += (dmg.weaponType == RANGED) ? plr->calcRating(CR_HIT_RANGED) : plr->calcRating(CR_HIT_MELEE);
10728
10729 float expertise_bonus = plr->calcRating(CR_EXPERTISE);
10730#if VERSION_STRING != Classic
10731 if (dmg.weaponType == MELEE)
10732 expertise_bonus += plr->getExpertise();
10733 else if (dmg.weaponType == OFFHAND)
10734 expertise_bonus += plr->getOffHandExpertise();
10735#endif
10736
10737 dodge -= expertise_bonus;
10738 if (dodge < 0)
10739 dodge = 0.0f;
10740
10741 parry -= expertise_bonus;
10742 if (parry < 0)
10743 parry = 0.0f;
10744 }
10745
10746 //by aura mods
10747 //Aura 248 SPELL_AURA_MOD_COMBAT_RESULT_CHANCE
10748 dodge += m_CombatResult_Dodge;
10749 if (dodge < 0)
10750 dodge = 0.0f;
10751
10752 //by damage type and by weapon type
10753 if (dmg.weaponType == RANGED)
10754 {
10755 dodge = 0.0f;
10756 parry = 0.0f;
10757 glanc = 0.0f;
10758 }
10759
10760 if (this->isPlayer())
10761 {
10762 it = static_cast<Player*>(this)->getItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_OFFHAND);
10763
10764 if (!ability && it != nullptr && (it->getItemProperties()->InventoryType == INVTYPE_WEAPON || it->getItemProperties()->InventoryType == INVTYPE_WEAPONOFFHAND))
10765 {
10766 // offhand weapon can either be a 1 hander weapon or an offhander weapon
10767 hitmodifier -= 24.0f; //dualwield miss chance
10768 }
10769 else
10770 {
10771 hitmodifier -= 5.0f; // base miss chance
10772 }
10773 }
10774 else
10775 {
10776 hitmodifier -= 5.0f; // mobs base hit chance
10777 }
10778
10779 hitchance += hitmodifier;
10780
10781 //Hackfix for Surprise Attacks
10782 if (this->isPlayer() && ability && static_cast<Player*>(this)->m_finishingMovesDodge && ability->custom_c_is_flags & SPELL_FLAG_IS_FINISHING_MOVE)
10783 dodge = 0.0f;
10784
10785 if (skip_hit_check)
10786 {
10787 hitchance = 100.0f;
10788 dodge = 0.0f;
10789 parry = 0.0f;
10790 block = 0.0f;
10791 }
10792
10793 if (ability != NULL && ability->getAttributes() & ATTRIBUTES_CANT_BE_DPB)
10794 {
10795 dodge = 0.0f;
10796 parry = 0.0f;
10797 block = 0.0f;
10798 }
10799
10800 if (ability && ability->getAttributesExB() & ATTRIBUTESEXB_CANT_CRIT)
10801 crit = 0.0f;
10802
10803 // by victim state
10804 if (pVictim->isPlayer() && pVictim->getStandState()) //every not standing state is>0
10805 {
10806 hitchance = 100.0f;
10807 dodge = 0.0f;
10808 parry = 0.0f;
10809 block = 0.0f;
10810 crush = 0.0f;
10811 crit = 100.0f;
10812 }
10813 if (backAttack)
10814 {
10815 if (pVictim->isPlayer())
10816 {
10817 dodge = 0.0f; //However mobs can dodge attacks from behind
10818 }
10819 parry = 0.0f;
10820 block = 0.0f;
10821 }
10822 //////////////////////////////////////////////////////////////////////////////////////////
10823 //One Roll Processing
10824 // cumulative chances generation
10825 float chances[7];
10826 chances[0] = std::max(0.0f, 100.0f - hitchance);
10827 chances[1] = chances[0] + dodge;
10828 chances[2] = chances[1] + parry;
10829 chances[3] = chances[2] + glanc;
10830 chances[4] = chances[3] + block;
10831 chances[5] = chances[4] + crit;
10832 chances[6] = chances[5] + crush;
10833
10834 // roll
10835 float Roll = Util::getRandomFloat(100.0f);
10836 uint32_t r = 0;
10837 while (r < 7 && Roll> chances[r])
10838 {
10839 r++;
10840 }
10841 if (force_crit)
10842 r = 5;
10843 // postroll processing
10844
10845 //trigger hostile action in ai
10846 pVictim->getAIInterface()->handleEvent(EVENT_HOSTILEACTION, this, 0);
10847
10848 switch (r)
10849 {
10850 case 0: // miss
10851 hit_status |= HITSTATUS_MISS;
10852 vstate = VisualState::MISS;
10853 break;
10854 case 1: //dodge
10855 if (pVictim->IsInWorld() && pVictim->isCreature() && static_cast<Creature*>(pVictim)->GetScript())
10856 static_cast<Creature*>(pVictim)->GetScript()->OnTargetDodged(this);
10857
10858 if (IsInWorld() && isCreature() && static_cast<Creature*>(this)->GetScript())
10859 static_cast<Creature*>(this)->GetScript()->OnDodged(this);
10860
10861 targetEvent = 1;
10862 vstate = VisualState::DODGE;
10863 pVictim->emote(EMOTE_ONESHOT_PARRYUNARMED); // Animation
10864
10865 if (this->isPlayer() && this->getClass() == WARRIOR)
10866 {
10867 auto* const playerMe = dynamic_cast<Player*>(this);
10868 playerMe->addComboPoints(pVictim->getGuid(), 1);
10869
10870 if (!sEventMgr.HasEvent(playerMe, EVENT_COMBO_POINT_CLEAR_FOR_TARGET))
10871 sEventMgr.AddEvent(playerMe, &Player::clearComboPoints, (uint32_t)EVENT_COMBO_POINT_CLEAR_FOR_TARGET, static_cast<uint32_t>(5000), static_cast<uint32_t>(1), static_cast<uint32_t>(0));
10872 else
10873 sEventMgr.ModifyEventTimeLeft(playerMe, EVENT_COMBO_POINT_CLEAR_FOR_TARGET, 5000, 0);
10874 }
10875
10876 // Rune strike
10877#if VERSION_STRING > TBC
10878 if (pVictim->isPlayer() && pVictim->getClass() == DEATHKNIGHT) // omg! dirty hack!
10879 pVictim->castSpell(pVictim, 56817, true);
10880#endif
10881
10883 if (!sEventMgr.HasEvent(pVictim, EVENT_DODGE_BLOCK_FLAG_EXPIRE))
10885 else
10886 sEventMgr.ModifyEventTimeLeft(pVictim, EVENT_DODGE_BLOCK_FLAG_EXPIRE, 5000, 0);
10887 break;
10888 case 2: //parry
10889 if (pVictim->IsInWorld() && pVictim->isCreature() && static_cast<Creature*>(pVictim)->GetScript())
10890 static_cast<Creature*>(pVictim)->GetScript()->OnTargetParried(this);
10891
10892 if (IsInWorld() && isCreature() && static_cast<Creature*>(this)->GetScript())
10893 static_cast<Creature*>(this)->GetScript()->OnParried(this);
10894
10895 targetEvent = 3;
10896 vstate = VisualState::PARRY;
10897 pVictim->emote(EMOTE_ONESHOT_PARRYUNARMED); // Animation
10898
10899 if (pVictim->isPlayer())
10900 {
10901#if VERSION_STRING > TBC
10902 // Rune strike
10903 if (pVictim->getClass() == DEATHKNIGHT) // omg! dirty hack!
10904 pVictim->castSpell(pVictim, 56817, true);
10905#endif
10906
10907 pVictim->addAuraStateAndAuras(AURASTATE_FLAG_PARRY); // SB@L: Enables spells requiring parry
10908 if (!sEventMgr.HasEvent(pVictim, EVENT_PARRY_FLAG_EXPIRE))
10910 else
10911 sEventMgr.ModifyEventTimeLeft(pVictim, EVENT_PARRY_FLAG_EXPIRE, 5000);
10912 if (pVictim->getClass() == 1 || pVictim->getClass() == 4) // warriors for 'revenge' and rogues for 'riposte'
10913 {
10914 pVictim->addAuraStateAndAuras(AURASTATE_FLAG_DODGE_BLOCK_PARRY); // SB@L: Enables spells requiring dodge
10915 if (!sEventMgr.HasEvent(pVictim, EVENT_DODGE_BLOCK_FLAG_EXPIRE))
10917 else
10918 sEventMgr.ModifyEventTimeLeft(pVictim, EVENT_DODGE_BLOCK_FLAG_EXPIRE, 5000);
10919 }
10920 }
10921 break;
10922 //////////////////////////////////////////////////////////////////////////////////////////
10923 //not miss,dodge or parry
10924 default:
10925 hit_status |= HITSTATUS_HITANIMATION;//hit animation on victim
10926 if (pVictim->m_schoolImmunityList[0])
10927 vstate = VisualState::IMMUNE;
10928 else
10929 {
10930 //////////////////////////////////////////////////////////////////////////////////////////
10931 //state proc initialization
10933 if (dmg.weaponType == RANGED)
10934 {
10935 if (ability != nullptr)
10936 {
10939 }
10940 else
10941 {
10944 }
10945 }
10946 else
10947 {
10948 if (ability != nullptr)
10949 {
10952 }
10953 else
10954 {
10957 }
10958
10959 if (dmg.weaponType == OFFHAND)
10960 {
10963 }
10964 }
10965 //////////////////////////////////////////////////////////////////////////////////////////
10966 //base damage calculation
10967 if (exclusive_damage)
10968 dmg.fullDamage = exclusive_damage;
10969 else
10970 {
10971 if (dmg.weaponType == MELEE && ability)
10972 dmg.fullDamage = CalculateDamage(this, pVictim, MELEE, ability->getSpellFamilyFlags(), ability);
10973 else
10974 dmg.fullDamage = CalculateDamage(this, pVictim, dmg.weaponType, 0, ability);
10975 }
10976
10977 if (pct_dmg_mod > 0)
10978 dmg.fullDamage = dmg.fullDamage * pct_dmg_mod / 100;
10979
10980 dmg.fullDamage += add_damage;
10981
10982
10983 dmg.fullDamage += pVictim->m_damageTakenMod[dmg.getSchoolTypeFromMask()];
10984 if (dmg.weaponType == RANGED)
10985 {
10986 dmg.fullDamage += pVictim->m_rangedDamageTaken;
10987 }
10988
10989 if (ability && ability->getMechanicsType() == MECHANIC_BLEEDING)
10990 disable_dR = true;
10991
10992
10994
10995 if (dmg.schoolMask != SCHOOL_MASK_NORMAL)
10997
10998 if (ability != NULL)
10999 {
11000 switch (ability->getId())
11001 {
11002 //SPELL_HASH_SHRED
11003 case 3252:
11004 case 5221:
11005 case 6800:
11006 case 8992:
11007 case 9829:
11008 case 9830:
11009 case 27001:
11010 case 27002:
11011 case 27555:
11012 case 48571:
11013 case 48572:
11014 case 49121:
11015 case 49165:
11016 case 61548:
11017 case 61549:
11019 break;
11020 }
11021 }
11022
11023 if (ability != NULL)
11024 {
11025 switch (ability->getId())
11026 {
11027 //SPELL_HASH_MAUL
11028 case 6807:
11029 case 6808:
11030 case 6809:
11031 case 7092:
11032 case 8972:
11033 case 9745:
11034 case 9880:
11035 case 9881:
11036 case 12161:
11037 case 15793:
11038 case 17156:
11039 case 20751:
11040 case 26996:
11041 case 27553:
11042 case 34298:
11043 case 48479:
11044 case 48480:
11045 case 51875:
11046 case 52506:
11047 case 54459:
11049 break;
11050 }
11051 }
11052
11053#if VERSION_STRING < Cata
11054 //pet happiness state dmg modifier
11055 if (isPet() && static_cast<Pet*>(this)->isHunterPet())
11056 dmg.fullDamage = (dmg.fullDamage <= 0) ? 0 : Util::float2int32(dmg.fullDamage * static_cast<Pet*>(this)->getHappinessDamageMod());
11057#endif
11058
11059 if (dmg.fullDamage < 0)
11060 dmg.fullDamage = 0;
11061 //////////////////////////////////////////////////////////////////////////////////////////
11062 //check for special hits
11063 switch (r)
11064 {
11065 //////////////////////////////////////////////////////////////////////////////////////////
11066 //glancing blow
11067 case 3:
11068 {
11069 float low_dmg_mod = 1.5f - (0.05f * diffAcapped);
11070 if (low_dmg_mod < 0.01)
11071 low_dmg_mod = 0.01f;
11072 if (low_dmg_mod > 0.91)
11073 low_dmg_mod = 0.91f;
11074 float high_dmg_mod = 1.2f - (0.03f * diffAcapped);
11075 if (high_dmg_mod > 0.99)
11076 high_dmg_mod = 0.99f;
11077 if (high_dmg_mod < 0.2)
11078 high_dmg_mod = 0.2f;
11079
11080 float damage_reduction = (high_dmg_mod + low_dmg_mod) / 2.0f;
11081 if (damage_reduction > 0)
11082 {
11083 dmg.fullDamage = Util::float2int32(damage_reduction * dmg.fullDamage);
11084 }
11085 hit_status |= HITSTATUS_GLANCING;
11086 }
11087 break;
11088 //////////////////////////////////////////////////////////////////////////////////////////
11089 //block
11090 case 4:
11091 {
11092 Item* shield = static_cast<Player*>(pVictim)->getItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_OFFHAND);
11093 if (shield != nullptr)
11094 {
11095 targetEvent = 2;
11096 pVictim->emote(EMOTE_ONESHOT_PARRYSHIELD);// Animation
11097
11099 {
11100 float block_multiplier = (100.0f + static_cast<Player*>(pVictim)->m_modBlockAbsorbValue) / 100.0f;
11101 if (block_multiplier < 1.0f)block_multiplier = 1.0f;
11102
11103 dmg.blockedDamage = Util::float2int32((shield->getItemProperties()->Block + ((static_cast<Player*>(pVictim)->m_modBlockValueFromSpells + static_cast<Player*>(pVictim)->getCombatRating(CR_BLOCK))) + ((pVictim->getStat(STAT_STRENGTH) / 2.0f) - 1.0f)) * block_multiplier);
11104
11106 dmg.blockedDamage *= 2;
11107 }
11108 else
11109 {
11110 dmg.blockedDamage = 0;
11111 }
11112
11113 if (dmg.fullDamage <= static_cast<int32_t>(dmg.blockedDamage))
11114 vstate = VisualState::BLOCK;
11115 if (dmg.blockedDamage)
11116 {
11117 if (pVictim->IsInWorld() && pVictim->isCreature() && static_cast<Creature*>(pVictim)->GetScript())
11118 static_cast<Creature*>(pVictim)->GetScript()->OnTargetBlocked(this, dmg.blockedDamage);
11119
11120 if (IsInWorld() && isCreature() && static_cast<Creature*>(this)->GetScript())
11121 static_cast<Creature*>(this)->GetScript()->OnBlocked(pVictim, dmg.blockedDamage);
11122 }
11123 if (pVictim->isPlayer()) //not necessary now but we'll have blocking mobs in future
11124 {
11125 pVictim->addAuraStateAndAuras(AURASTATE_FLAG_DODGE_BLOCK_PARRY); //SB@L: Enables spells requiring dodge
11126 if (!sEventMgr.HasEvent(pVictim, EVENT_DODGE_BLOCK_FLAG_EXPIRE))
11128 else
11129 sEventMgr.ModifyEventTimeLeft(pVictim, EVENT_DODGE_BLOCK_FLAG_EXPIRE, 5000);
11130 }
11131 }
11132 }
11133 break;
11134 //////////////////////////////////////////////////////////////////////////////////////////
11135 //critical hit
11136 case 5:
11137 {
11138 hit_status |= HITSTATUS_CRICTICAL;
11139 //LogDebug("DEBUG: Critical Strike! Full_damage: %u" , dmg.full_damage);
11140 if (ability != nullptr && castingSpell != nullptr)
11141 {
11142 applySpellModifiers(SPELLMOD_CRITICAL_DAMAGE, &dmg.fullDamage, ability, castingSpell);
11143 }
11144
11145 //LogDebug("DEBUG: After m_critMeleeDamageTakenPctMod: %u" , dmg.full_damage);
11146 if (isPlayer())
11147 {
11148 if (dmg.weaponType != RANGED)
11149 {
11150 dmg.fullDamage += dmg.fullDamage * static_cast<Player*>(this)->m_modPhysCritDmgPct / 100;
11151 }
11152 if (!pVictim->isPlayer())
11153 dmg.fullDamage += Util::float2int32(dmg.fullDamage * static_cast<Player*>(this)->m_increaseCricticalByTypePct[static_cast<Creature*>(pVictim)->GetCreatureProperties()->Type]);
11154 //LogDebug("DEBUG: After IncreaseCricticalByTypePCT: %u" , dmg.full_damage);
11155 }
11156
11157 if (dmg.weaponType == RANGED)
11159 else
11161
11162 if (pVictim->isPlayer())
11163 {
11164 //Resilience is a special new rating which was created to reduce the effects of critical hits against your character.
11165#if VERSION_STRING >= Cata
11166 float dmg_reduction_pct = 2.0f * static_cast<Player*>(pVictim)->calcRating(CR_RESILIENCE_CRIT_TAKEN) / 100.0f;
11167#else
11168 float dmg_reduction_pct = 2.0f * static_cast<Player*>(pVictim)->calcRating(CR_CRIT_TAKEN_MELEE) / 100.0f;
11169#endif
11170 if (dmg_reduction_pct > 1.0f)
11171 dmg_reduction_pct = 1.0f; //we cannot resist more then he is criticalling us, there is no point of the critical then :P
11172 dmg.fullDamage = Util::float2int32(dmg.fullDamage - dmg.fullDamage * dmg_reduction_pct);
11173 //LogDebug("DEBUG: After Resilience check: %u" , dmg.full_damage);
11174 }
11175
11176 if (pVictim->isCreature() && static_cast<Creature*>(pVictim)->GetCreatureProperties()->Rank != ELITE_WORLDBOSS)
11178
11179 if (pVictim->IsInWorld() && pVictim->isCreature() && static_cast<Creature*>(pVictim)->GetScript())
11180 static_cast<Creature*>(pVictim)->GetScript()->OnTargetCritHit(this, dmg.fullDamage);
11181
11182 if (IsInWorld() && isCreature() && static_cast<Creature*>(this)->GetScript())
11183 static_cast<Creature*>(this)->GetScript()->OnCritHit(pVictim, dmg.fullDamage);
11184 }
11185 break;
11186 //////////////////////////////////////////////////////////////////////////////////////////
11187 //crushing blow
11188 case 6:
11189 hit_status |= HITSTATUS_CRUSHINGBLOW;
11190 dmg.fullDamage = (dmg.fullDamage * 3) >> 1;
11191 break;
11192 //////////////////////////////////////////////////////////////////////////////////////////
11193 //regular hit
11194 default:
11195 break;
11196 }
11197 //////////////////////////////////////////////////////////////////////////////////////////
11198 //Post Roll Damage Processing
11199 //////////////////////////////////////////////////////////////////////////////////////////
11200 //absorption
11201 uint32_t dm = dmg.fullDamage;
11202 dmg.absorbedDamage = pVictim->absorbDamage(dmg.schoolMask, &dm);
11203
11204 if (dmg.fullDamage > static_cast<int32_t>(dmg.blockedDamage))
11205 {
11207 //////////////////////////////////////////////////////////////////////////////////////////
11208 //armor reducing
11209 if (sh)
11210 {
11211 dmg.fullDamage -= sh;
11212 if (dmg.fullDamage && !disable_dR)
11213 calculateResistanceReduction(pVictim, &dmg, ability, ArmorPctReduce);
11214 dmg.fullDamage += sh;
11215 dmg.absorbedDamage += sh;
11216 }
11217 else if (!disable_dR)
11218 calculateResistanceReduction(pVictim, &dmg, ability, ArmorPctReduce);
11219 }
11220
11221 if (dmg.schoolMask == SCHOOL_MASK_NORMAL)
11222 {
11223 dmg.absorbedDamage += dmg.resistedDamage;
11224 dmg.resistedDamage = 0;
11225 }
11226
11227 int32_t realdamage = dmg.fullDamage - dmg.absorbedDamage - dmg.resistedDamage - dmg.blockedDamage;
11228 if (realdamage < 0)
11229 {
11230 realdamage = 0;
11231 if (!(hit_status & HITSTATUS_BLOCK))
11232 hit_status |= HITSTATUS_ABSORBED;
11233 else
11234 hit_status |= HITSTATUS_BLOCK;
11235 }
11236 dmg.realDamage = realdamage;
11237 if (IsInWorld() && isCreature() && static_cast<Creature*>(this)->GetScript())
11238 static_cast<Creature*>(this)->GetScript()->OnHit(pVictim, static_cast<float>(realdamage));
11239 }
11240 break;
11241 }
11242
11243 //////////////////////////////////////////////////////////////////////////////////////////
11244 //Post Roll Special Cases Processing
11245 //////////////////////////////////////////////////////////////////////////////////////////
11246 // Special Effects Processing
11247 // Paladin: Blessing of Sacrifice, and Warlock: Soul Link
11248 if (pVictim->m_damageSplitTarget)
11249 {
11250 dmg.fullDamage = pVictim->doDamageSplitTarget(dmg.fullDamage, dmg.schoolMask, true);
11251 dmg.realDamage = dmg.fullDamage;
11252 }
11253 //////////////////////////////////////////////////////////////////////////////////////////
11254 //special states processing
11255 if (pVictim->isCreature())
11256 {
11257 if (pVictim->isInEvadeMode())
11258 /* || (pVictim->getAIInterface()->GetIsSoulLinked() && pVictim->getAIInterface()->getSoullinkedWith() != this))*/
11259 {
11260 vstate = VisualState::EVADE;
11261 dmg.realDamage = 0;
11262 dmg.fullDamage = 0;
11263 dmg.resistedDamage = 0;
11264 }
11265 }
11266 if (pVictim->isPlayer() && static_cast<Player*>(pVictim)->m_cheats.hasGodModeCheat == true)
11267 {
11268 dmg.resistedDamage = dmg.fullDamage; //godmode
11269 }
11270 //////////////////////////////////////////////////////////////////////////////////////////
11271 //dirty fixes
11272 //vstate=1-wound,2-dodge,3-parry,4-interrupt,5-block,6-evade,7-immune,8-deflect
11273 // the above code was remade it for reasons : damage shield needs moslty same flags as handleproc + dual wield should proc too ?
11274
11275 //damage shield must come before handleproc to not loose 1 charge : spell gets removed before last charge
11276 if (dmg.realDamage > 0 && dmg.weaponType != OFFHAND)
11277 {
11278 pVictim->handleProcDmgShield(dmg.victimProcFlags, this);
11280 }
11281
11282 dmg.isCritical = hit_status & HITSTATUS_CRICTICAL;
11283
11284 /*if (resisted_dmg)
11285 {
11286 dmg.resistedDamage += resisted_dmg;
11287 dmg.fullDamage -= resisted_dmg;
11288 dmg.realDamage = dmg.realDamage - resisted_dmg < 0 ? 0 : dmg.realDamage - resisted_dmg;
11289 }*/
11290 //////////////////////////////////////////////////////////////////////////////////////////
11291 //spells triggering
11292 if (dmg.realDamage > 0 && ability == 0)
11293 {
11294 //ugly hack for shadowfiend restoring mana
11295 if (getSummonedByGuid() != 0 && getEntry() == 19668)
11296 {
11297 Player* owner = getWorldMap()->getPlayer(static_cast<uint32_t>(getSummonedByGuid()));
11298 if (owner)
11299 {
11300 uint32_t amount = static_cast<uint32_t>(owner->getMaxPower(POWER_TYPE_MANA) * 0.05f);
11301 this->energize(owner, 34650, amount, POWER_TYPE_MANA);
11302 }
11303 }
11304 //ugly hack for Bloodsworm restoring hp
11305 if (getSummonedByGuid() != 0 && getEntry() == 28017)
11306 {
11307 Player* owner = getWorldMap()->getPlayer(static_cast<uint32_t>(getSummonedByGuid()));
11308 if (owner != NULL)
11309 owner->addSimpleHealingBatchEvent(Util::float2int32(1.5f * dmg.realDamage), owner, sSpellMgr.getSpellInfo(50452));
11310 }
11311 }
11312
11313 //////////////////////////////////////////////////////////////////////////////////////////
11314 //Data Sending
11315 if (!ability)
11316 {
11317 if (dmg.fullDamage > 0)
11318 {
11319#if VERSION_STRING >= WotLK
11320 if (dmg.fullDamage == (int32_t)dmg.absorbedDamage)
11321 hit_status |= HITSTATUS_ABSORB_FULL;
11322 else if (dmg.absorbedDamage > 0)
11323 hit_status |= HITSTATUS_ABSORB_PARTIAL;
11324#else
11325 if (dmg.absorbedDamage > 0)
11326 hit_status |= HITSTATUS_ABSORBED;
11327#endif
11328
11329 if (dmg.fullDamage <= static_cast<int32_t>(dmg.resistedDamage))
11330 {
11331 hit_status |= HITSTATUS_RESIST;
11332 dmg.resistedDamage = dmg.fullDamage;
11333 }
11334 }
11335
11336 if (dmg.fullDamage < 0)
11337 dmg.fullDamage = 0;
11338 }
11339
11340 if (this != pVictim && vstate != VisualState::EVADE)
11341 {
11342 if (castingSpell == nullptr)
11343 {
11344 // Send initial threat
11345 if (pVictim->isCreature())
11346 pVictim->getAIInterface()->onHostileAction(this);
11347
11348 // Handle combat for both caster and victim if normal attack
11349 // For spells this is handled in spell system
11351 pVictim->getCombatHandler().takeCombatAction(this);
11352 }
11353
11354 // Add real threat
11355 if (pVictim->getThreatManager().canHaveThreatList())
11356 {
11357 const auto threat = dmg.realDamage == 0 ? 1 : dmg.realDamage;
11358 const auto spellInfo = castingSpell != nullptr ? castingSpell->getSpellInfo() : ability;
11359 pVictim->getThreatManager().addThreat(this, static_cast<float>(threat), spellInfo, false, false, castingSpell);
11360 }
11361 }
11362
11363 if (ability && dmg.realDamage == 0)
11364 {
11365 auto logSent = true;
11366 switch (vstate)
11367 {
11368 case VisualState::MISS:
11369 SendSpellLog(this, pVictim, ability->getId(), SPELL_LOG_MISS);
11370 break;
11371 case VisualState::DODGE:
11372 SendSpellLog(this, pVictim, ability->getId(), SPELL_LOG_DODGE);
11373 break;
11374 case VisualState::PARRY:
11375 SendSpellLog(this, pVictim, ability->getId(), SPELL_LOG_PARRY);
11376 break;
11377 case VisualState::EVADE:
11378 SendSpellLog(this, pVictim, ability->getId(), SPELL_LOG_EVADE);
11379 break;
11381 SendSpellLog(this, pVictim, ability->getId(), SPELL_LOG_IMMUNE);
11382 break;
11383 default:
11384 logSent = false;
11385 break;
11386 }
11387
11388 if (logSent)
11389 return dmg;
11390 }
11391 //////////////////////////////////////////////////////////////////////////////////////////
11392 //Damage Dealing
11393
11394 if (this->isPlayer() && ability)
11395 static_cast<Player*>(this)->m_castedAmount[dmg.getSchoolTypeFromMask()] = dmg.realDamage + dmg.absorbedDamage;
11396
11397 // Generate rage on damage done
11398 ///\ todo: this is inaccurate and almost directly copied here from few lines below
11399 uint32_t rageGenerated = 0;
11400 if (dmg.fullDamage > 0 && isPlayer() && getPowerType() == POWER_TYPE_RAGE && ability == nullptr)
11401 {
11402 float_t val = 0.0f;
11403 uint32_t level = getLevel();
11404 float_t conv = 0.0f;
11405 if (level <= DBC_PLAYER_LEVEL_CAP)
11406 conv = AttackToRageConversionTable[level];
11407 else
11408 conv = 3.75f / (0.0091107836f * level * level + 3.225598133f * level + 4.2652911f);
11409
11410 // Hit Factor
11411 float_t f = (dmg.weaponType == OFFHAND) ? 1.75f : 3.5f;
11412
11413 if (hit_status & HITSTATUS_CRICTICAL)
11414 f *= 2.0f;
11415
11416 float_t s = 1.0f;
11417
11418 // Weapon speed (normal)
11419 const auto weapon = (static_cast<Player*>(this)->getItemInterface())->GetInventoryItem(INVENTORY_SLOT_NOT_SET, (dmg.weaponType == OFFHAND ? EQUIPMENT_SLOT_OFFHAND : EQUIPMENT_SLOT_MAINHAND));
11420 if (weapon == nullptr)
11421 {
11422 if (dmg.weaponType == OFFHAND)
11423 s = getBaseAttackTime(OFFHAND) / 1000.0f;
11424 else
11425 s = getBaseAttackTime(MELEE) / 1000.0f;
11426 }
11427 else
11428 {
11429 const auto entry = weapon->getEntry();
11430 const auto pProto = sMySQLStore.getItemProperties(entry);
11431 if (pProto != nullptr)
11432 {
11433 s = pProto->Delay / 1000.0f;
11434 }
11435 }
11436
11437 val = conv * dmg.fullDamage + f * s / 2.0f;
11438 val *= (1 + (static_cast<Player*>(this)->m_rageFromDamageDealt / 100.0f));
11439 const auto ragerate = worldConfig.getFloatRate(RATE_POWER2);
11440 val *= 10 * ragerate;
11441
11442 if (val > 0)
11443 {
11444 rageGenerated = static_cast<uint32_t>(std::ceil(val));
11445#if VERSION_STRING > TBC
11446 hit_status |= HITSTATUS_RAGE_GAIN;
11447#endif
11448 }
11449 }
11450
11451 // Calculate estimated overkill based on current health and current health events in health batch
11452 const auto overKill = pVictim->calculateEstimatedOverKillForCombatLog(dmg.realDamage);
11453 if (ability == nullptr)
11454 sendAttackerStateUpdate(GetNewGUID(), pVictim->GetNewGUID(), static_cast<HitStatus>(hit_status), dmg.realDamage, overKill, dmg, dmg.absorbedDamage, vstate, dmg.blockedDamage, rageGenerated);
11455 else if (dmg.fullDamage > 0)
11456 pVictim->sendSpellNonMeleeDamageLog(this, pVictim, ability, dmg.realDamage, dmg.absorbedDamage, dmg.resistedDamage, dmg.blockedDamage, overKill, false, hit_status & HITSTATUS_CRICTICAL);
11457
11458 // invincible people don't take damage
11459 if (pVictim->m_isInvincible == false)
11460 {
11461 if (dmg.realDamage)
11462 {
11463 auto batch = std::make_unique<HealthBatchEvent>();
11464 batch->caster = this;
11465 batch->damageInfo = dmg;
11466 batch->spellInfo = ability;
11467
11468 pVictim->addHealthBatchEvent(std::move(batch));
11469 //pVictim->HandleProcDmgShield(PROC_ON_MELEE_ATTACK_VICTIM,this);
11470 // HandleProcDmgShield(PROC_ON_MELEE_ATTACK_VICTIM,pVictim);
11471
11472 if (pVictim->isCastingSpell())
11473 {
11476 else if (pVictim->getCurrentSpell(CURRENT_GENERIC_SPELL) != nullptr && pVictim->getCurrentSpell(CURRENT_GENERIC_SPELL)->getCastTimeLeft() > 0)
11478 }
11479 }
11480 }
11481
11482 // Tagging should happen when damage packets are sent
11483 const auto plrOwner = getPlayerOwnerOrSelf();
11484 if (plrOwner != nullptr && pVictim->isCreature() && pVictim->isTaggableFor(this))
11485 {
11486 pVictim->setTaggerGuid(this);
11487 plrOwner->tagUnit(pVictim);
11488 }
11489
11490 //////////////////////////////////////////////////////////////////////////////////////////
11491 //Post Damage Dealing Processing
11492 //////////////////////////////////////////////////////////////////////////////////////////
11493 // proc handling
11494
11495 // If called from spell class, handle caster's procs when spell has finished all targets
11496 if (castingSpell == nullptr)
11497 handleProc(dmg.attackerProcFlags, pVictim, ability, dmg, isSpellTriggered);
11498
11499 pVictim->handleProc(dmg.victimProcFlags, this, ability, dmg, isSpellTriggered);
11500
11501 //durability processing
11502 if (pVictim->isPlayer())
11503 {
11504 static_cast<Player*>(pVictim)->getItemInterface()->ReduceItemDurability();
11505 if (!this->isPlayer())
11506 {
11507 Player* pr = static_cast<Player*>(pVictim);
11509 {
11510 pr->advanceSkillLine(SKILL_DEFENSE, static_cast<uint16_t>(Util::float2int32(1.0f * worldConfig.getFloatRate(RATE_SKILLRATE))));
11511#if VERSION_STRING >= TBC // support classic
11512 pr->updateChances();
11513#endif
11514 }
11515 }
11516 else
11517 {
11518 static_cast<Player*>(this)->getItemInterface()->ReduceItemDurability();
11519 }
11520 }
11521 else
11522 {
11523 if (this->isPlayer())//not pvp
11524 {
11525 static_cast<Player*>(this)->getItemInterface()->ReduceItemDurability();
11526 Player* pr = static_cast<Player*>(this);
11527 if (Util::checkChance(pr->getSkillUpChance(SubClassSkill) * worldConfig.getFloatRate(RATE_SKILLCHANCE)))
11528 {
11529 pr->advanceSkillLine(SubClassSkill, static_cast<uint16_t>(Util::float2int32(1.0f * worldConfig.getFloatRate(RATE_SKILLRATE))));
11530 //pr->UpdateChances();
11531 }
11532 }
11533 }
11534 //////////////////////////////////////////////////////////////////////////////////////////
11535 //rage processing
11536 //http://www.wowwiki.com/Formulas:Rage_generation
11537
11538 if (rageGenerated > 0)
11539 {
11540 modPower(POWER_TYPE_RAGE, static_cast<int32_t>(rageGenerated));
11541 if (getPower(POWER_TYPE_RAGE) > 1000)
11543 }
11544
11546 //////////////////////////////////////////////////////////////////////////////////////////
11547 //extra strikes processing
11549 {
11550 int32_t extra_attacks = m_extraAttacks;
11551 m_extraAttackCounter = true;
11552 m_extraAttacks = 0;
11553
11554 while (extra_attacks > 0)
11555 {
11556 extra_attacks--;
11557 strike(pVictim, dmg.weaponType, NULL, 0, 0, 0, false, false);
11558 }
11559
11560 m_extraAttackCounter = false;
11561 }
11562
11564 {
11565 m_extraStrikeTarget = true;
11566
11567 for (auto itx = m_extraStrikeTargets.begin(); itx != m_extraStrikeTargets.end();)
11568 {
11569 auto itx2 = itx++;
11570 const auto& ex = *itx2;
11571
11572 for (const auto& itr : getInRangeObjectsSet())
11573 {
11574 if (!itr || itr == pVictim || !itr->isCreatureOrPlayer())
11575 continue;
11576
11577 if (CalcDistance(itr) < 5.0f && this->isValidTarget(itr) && itr->isInFront(this) && !static_cast<Unit*>(itr)->isPacified())
11578 {
11579 // Sweeping Strikes hits cannot be dodged, missed or parried (from wowhead)
11580 bool skip_hit_check2 = ex->spell_info->getId() == 12328 ? true : false;
11581 //zack : should we use the spell id the registered this extra strike when striking ? It would solve a few proc on proc problems if so ;)
11582 // Strike(TO<Unit*>(*itr), weapon_damage_type, ability, add_damage, pct_dmg_mod, exclusive_damage, false, skip_hit_check);
11583 strike(static_cast<Unit*>(itr), dmg.weaponType, ex->spell_info, add_damage, pct_dmg_mod, exclusive_damage, false, skip_hit_check2);
11584 break;
11585 }
11586 }
11587
11588 // Sweeping Strikes charges are used up regardless whether there is a secondary target in range or not. (from wowhead)
11589 if (ex->charges > 0)
11590 {
11591 ex->charges--;
11592 if (ex->charges <= 0)
11593 {
11595 m_extraStrikeTargets.erase(itx2);
11596 }
11597 }
11598 }
11599
11600 m_extraStrikeTarget = false;
11601 }
11602
11603 return dmg;
11604}
@ EVENT_HOSTILEACTION
Definition AIEvents.h:26
@ AURA_INTERRUPT_ON_START_ATTACK
@ AURASTATE_FLAG_DODGE_BLOCK_PARRY
@ AURASTATE_FLAG_PARRY
@ EVENT_COMBO_POINT_CLEAR_FOR_TARGET
Definition EventMgr.h:81
@ EVENT_DODGE_BLOCK_FLAG_EXPIRE
Definition EventMgr.h:68
@ EVENT_PARRY_FLAG_EXPIRE
Definition EventMgr.h:70
@ ITEM_SUBCLASS_WEAPON_MACE
#define INVENTORY_SLOT_NOT_SET
@ CURRENT_CHANNELED_SPELL
Definition Object.hpp:68
@ CURRENT_GENERIC_SPELL
Definition Object.hpp:67
@ CR_EXPERTISE
@ CR_BLOCK
@ MOD_RANGED
@ MOD_MELEE
@ PROC_ON_TAKEN_ANY_DAMAGE
Definition ProcFlags.hpp:39
@ PROC_ON_DONE_MELEE_HIT
Definition ProcFlags.hpp:16
@ PROC_ON_DONE_RANGED_HIT
Definition ProcFlags.hpp:21
@ PROC_ON_DONE_OFFHAND_ATTACK
Definition ProcFlags.hpp:41
@ PROC_ON_TAKEN_OFFHAND_ATTACK
Definition ProcFlags.hpp:42
@ PROC_ON_TAKEN_MELEE_HIT
Definition ProcFlags.hpp:17
@ PROC_ON_TAKEN_RANGED_HIT
Definition ProcFlags.hpp:22
@ PROC_ON_TAKEN_RANGED_SPELL_HIT
Definition ProcFlags.hpp:24
@ PROC_ON_TAKEN_MELEE_SPELL_HIT
Definition ProcFlags.hpp:19
@ PROC_ON_DONE_MELEE_SPELL_HIT
Definition ProcFlags.hpp:18
@ PROC_ON_DONE_RANGED_SPELL_HIT
Definition ProcFlags.hpp:23
SchoolMask
Definition School.hpp:23
@ ATTRIBUTESEXB_CANT_CRIT
@ ATTRIBUTESEX_IGNORE_IN_FRONT
@ SPELL_LOG_DODGE
Definition SpellLog.hpp:13
@ SPELL_LOG_EVADE
Definition SpellLog.hpp:16
@ SPELL_LOG_MISS
Definition SpellLog.hpp:11
@ SPELL_LOG_IMMUNE
Definition SpellLog.hpp:17
@ SPELL_LOG_PARRY
Definition SpellLog.hpp:14
static const uint32_t g_spellSchoolConversionTable[TOTAL_SPELL_SCHOOLS]
@ SPELL_TARGET_AREA_MASK
Definition SpellTarget.h:52
uint32_t CalculateDamage(Unit *pAttacker, Unit *pVictim, uint32_t weapon_damage_type, const uint32_t *, SpellInfo const *ability)
Definition Stats.cpp:626
@ STAT_STRENGTH
Definition Stats.h:33
@ EMOTE_ONESHOT_PARRYSHIELD
@ EMOTE_ONESHOT_WOUNDCRITICAL
@ EMOTE_ONESHOT_PARRYUNARMED
VisualState
HitStatus
@ HITSTATUS_GLANCING
@ HITSTATUS_HITANIMATION
@ HITSTATUS_DUALWIELD
@ HITSTATUS_BLOCK
@ HITSTATUS_CRICTICAL
@ HITSTATUS_RESIST
@ HITSTATUS_MISS
@ HITSTATUS_ABSORBED
@ HITSTATUS_CRUSHINGBLOW
@ RATE_SKILLCHANCE
Definition WorldConfig.h:37
@ RATE_SKILLRATE
Definition WorldConfig.h:38
@ RATE_POWER2
Definition WorldConfig.h:16
void handleEvent(uint32_t event, Unit *pUnit, uint32_t misc1)
void takeCombatAction(Unit *initiater, bool friendlyCombat=false, bool skipInitialDelay=false)
void onHostileAction(Unit *victim, bool skipInitialDelay=false)
virtual void OnTargetParried(Unit *)
virtual void OnCritHit(Unit *, int32_t)
virtual void OnDodged(Unit *)
virtual void OnBlocked(Unit *, int32_t)
virtual void OnParried(Unit *)
float GetBaseParry()
uint8_t BaseAttackType
Definition Creature.h:262
bool isValidTarget(Object *target, SpellInfo const *bySpell=nullptr)
Definition Object.cpp:4073
void SendSpellLog(Object *Caster, Object *Target, uint32_t Ability, uint8_t SpellLogType)
SpellLog packets just to keep the code cleaner and better to read.
Definition Object.cpp:4339
bool isCastingSpell(bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false) const
Definition Object.cpp:735
uint32_t getCombatRating(uint8_t combatRating) const
Definition Player.cpp:1276
void updateChances()
Definition Player.cpp:15401
float getSkillUpChance(uint16_t id)
Definition Player.cpp:5191
void advanceSkillLine(uint16_t skillLine, uint16_t amount=1)
Definition Player.cpp:4713
void clearComboPoints()
Definition Player.cpp:5420
uint32_t getOffHandExpertise() const
Definition Player.cpp:1095
void addComboPoints(uint64_t targetGuid, int8_t points)
Definition Player.cpp:5366
float getBlockChance()
Definition Player.cpp:15383
float m_increaseCricticalByTypePct[12]
Definition Player.hpp:2078
float getDodgeChance()
Definition Player.cpp:15343
uint32_t getExpertise() const
Definition Player.cpp:1091
uint32_t m_modBlockValueFromSpells
Definition Player.hpp:2049
float getParryChance()
Definition Player.cpp:15392
int32_t getCastTimeLeft() const
Definition Spell.cpp:5545
void AddTime(uint32_t type)
void addThreat(Unit *target, float amount, SpellInfo const *spell=nullptr, bool ignoreModifiers=false, bool ignoreRedirects=false, Spell *castingSpell=nullptr)
static bool canHaveThreatList(Unit const *who)
int32_t m_damageTakenMod[TOTAL_SPELL_SCHOOLS]
Definition Unit.hpp:1371
int32_t m_rangedDamageTaken
Definition Unit.hpp:1386
float m_ignoreArmorPctMaceSpec
Definition Unit.hpp:1431
uint32_t isStunned() const
Definition Unit.hpp:1351
float m_critRangedDamageTakenPctMod[TOTAL_SPELL_SCHOOLS]
Definition Unit.hpp:1383
float m_damageTakenPctMod[TOTAL_SPELL_SCHOOLS]
Definition Unit.hpp:1374
void handleProcDmgShield(uint32_t flag, Unit *attacker)
Definition Unit.cpp:16972
bool m_extraAttackCounter
Definition Unit.hpp:1318
void addSimpleHealingBatchEvent(uint32_t heal, Unit *healer=nullptr, SpellInfo const *spellInfo=nullptr)
Definition Unit.cpp:7395
void calculateResistanceReduction(Unit *unitVictim, DamageInfo *damageInfo, SpellInfo const *spellInfoAbility, float armorPctReduce)
Definition Unit.cpp:9513
int32_t m_extraAttacks
Definition Unit.hpp:1466
float m_critMeleeDamageTakenPctMod[TOTAL_SPELL_SCHOOLS]
Definition Unit.hpp:1380
uint32_t doDamageSplitTarget(uint32_t res, SchoolMask schoolMask, bool isMeleeDmg)
Definition Unit.cpp:9256
float m_modDamageTakenByMechPct[32]
Definition Unit.hpp:1422
bool m_extraStrikeTarget
Definition Unit.hpp:1467
bool isInEvadeMode() const
Definition Unit.hpp:722
int32_t m_CombatResult_Dodge
Definition Unit.hpp:546
float getDodgeFromSpell() const
Definition Unit.hpp:1520
uint32_t handleProc(uint32_t flag, Unit *Victim, SpellInfo const *CastingSpell, DamageInfo damageInfo, bool isSpellTriggered, ProcEvents procEvent=PROC_EVENT_DO_ALL, Aura *triggeredFromAura=nullptr)
Definition Unit.cpp:11606
uint32_t isFeared() const
Definition Unit.hpp:1354
uint32_t calculateEstimatedOverKillForCombatLog(uint32_t damage) const
Definition Unit.cpp:7430
void energize(Unit *target, uint32_t spellId, uint32_t amount, PowerType type, bool sendPacket=true)
Definition Unit.cpp:6680
uint32_t getManaShieldAbsorbedDamage(uint32_t damage)
Definition Unit.cpp:9647
float m_ignoreArmorPct
Definition Unit.hpp:1432
uint32_t isPacified() const
Definition Unit.hpp:1348
float getParryFromSpell() const
Definition Unit.hpp:1519
uint32_t m_blockModPct
Definition Unit.hpp:1539
Player * getPlayer(uint32_t guid)
uint32_t blockedDamage
uint32_t victimProcFlags
uint32_t attackerProcFlags
uint32_t Type
ItemDamage Damage[MAX_ITEM_PROTO_DAMAGES]
Here is the caller graph for this function:

◆ takeDamage()

void Unit::takeDamage ( Unit attacker,
uint32_t  damage,
uint32_t  spellId 
)

Definition at line 7158 of file Unit.cpp.

7159{
7160 // Call damage taken creature script hook on entire batch
7161 if (attacker != nullptr && isCreature())
7162 sScriptMgr.DamageTaken(dynamic_cast<Creature*>(this), attacker, &damage);
7163
7164 // Hackfix - Ardent Defender
7166 damage = damage - Util::float2int32(damage * m_damageTakenPctModOnHP35) / 100;
7167
7168 if (damage >= getHealth())
7169 {
7170 if (isTrainingDummy())
7171 {
7172 setHealth(1);
7173 return;
7174 }
7175
7176 // Duel check
7177 if (isPlayer() && dynamic_cast<Player*>(this)->getDuelPlayer() != nullptr)
7178 {
7179 setHealth(5);
7180 dynamic_cast<Player*>(this)->getDuelPlayer()->endDuel(DUEL_WINNER_KNOCKOUT);
7182 return;
7183 }
7184
7185 // The attacker must exist here and if it doesn't exist, victim won't die
7186 if (attacker == nullptr)
7187 return;
7188
7189 if (auto* const plrOwner = attacker->getPlayerOwnerOrSelf())
7190 {
7191 if (plrOwner->getBattleground())
7192 {
7193 plrOwner->getBattleground()->HookOnUnitKill(plrOwner, this);
7194
7195 if (isPlayer())
7196 plrOwner->getBattleground()->HookOnPlayerKill(plrOwner, dynamic_cast<Player*>(this));
7197 }
7198
7199 if (isPlayer())
7200 {
7201 sHookInterface.OnKillPlayer(plrOwner, dynamic_cast<Player*>(this));
7202 }
7203 else if (isCreature())
7204 {
7205 plrOwner->onKillUnitReputation(this, false);
7206#ifdef FT_ACHIEVEMENTS
7207 plrOwner->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLING_BLOW, attacker->GetMapId(), 0, 0);
7208#endif
7209 }
7210
7211 // Check is the unit gray level for attacker
7212 if (!isGrayLevel(plrOwner->getLevel(), getLevel()) && (getGuid() != attacker->getGuid()))
7213 {
7214 if (isPlayer())
7215 {
7216#ifdef FT_ACHIEVEMENTS
7217 plrOwner->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA, plrOwner->getAreaId(), 1, 0);
7218 plrOwner->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL, 1, 0, 0);
7219#endif
7220 HonorHandler::OnPlayerKilled(plrOwner, dynamic_cast<Player*>(this));
7221 }
7222
7223 plrOwner->addAuraStateAndAuras(AURASTATE_FLAG_LASTKILLWITHHONOR);
7224
7225 if (!sEventMgr.HasEvent(plrOwner, EVENT_LASTKILLWITHHONOR_FLAG_EXPIRE))
7227 else
7228 sEventMgr.ModifyEventTimeLeft(plrOwner, EVENT_LASTKILLWITHHONOR_FLAG_EXPIRE, 20000);
7229
7230 plrOwner->handleProc(PROC_ON_KILL, this, nullptr, DamageInfo(), false);
7231 }
7232
7233 // Send zone under attack message
7234 if (isPvpFlagSet())
7235 {
7236 auto team = plrOwner->getTeam();
7237 if (team == TEAM_ALLIANCE)
7238 team = TEAM_HORDE;
7239 else
7240 team = TEAM_ALLIANCE;
7241
7242 const auto area = GetArea();
7243 sWorld.sendZoneUnderAttackMessage(area != nullptr ? area->id : attacker->getZoneId(), team);
7244 }
7245 }
7246
7247 if (attacker->isPlayer())
7248 {
7249 const auto plr = dynamic_cast<Player*>(attacker);
7250
7251 plr->eventAttackStop();
7252
7253 plr->sendPartyKillLogPacket(getGuid());
7254 }
7255
7256 die(attacker, damage, spellId);
7257
7258 // Loot
7259 if (isLootable())
7260 {
7261 const auto tagger = getWorldMapPlayer(getTaggerGuid());
7262 if (tagger != nullptr)
7263 {
7264 if (tagger->isInGroup()) // Group Case
7265 {
7266 for (uint8_t i = 0; i < tagger->getGroup()->GetSubGroupCount(); i++)
7267 {
7268 if (tagger->getGroup()->GetSubGroup(i) != nullptr)
7269 {
7270 for (auto itr : tagger->getGroup()->GetSubGroup(i)->getGroupMembers())
7271 {
7272 if (itr != nullptr)
7273 {
7274 if (Player* loggedInPlayer = sObjectMgr.getPlayer(itr->guid))
7275 {
7276 if (ToCreature()->HasLootForPlayer(loggedInPlayer))
7277 loggedInPlayer->sendLootUpdate(this);
7278 }
7279 }
7280 }
7281 }
7282 }
7283 }
7284 else if (ToCreature()->HasLootForPlayer(tagger)) // Player case
7285 {
7286 tagger->sendLootUpdate(this);
7287 }
7288 }
7289 }
7290
7291 if (!isPet() && getCreatedByGuid() == 0)
7292 {
7293 // Experience points
7294 if (isTagged())
7295 {
7296 const auto taggerUnit = getWorldMapUnit(getTaggerGuid());
7297 const auto tagger = taggerUnit != nullptr ? taggerUnit->getPlayerOwnerOrSelf() : nullptr;
7298 if (tagger != nullptr)
7299 {
7300 if (tagger->isInGroup())
7301 {
7302 tagger->giveGroupXP(this, tagger);
7303 }
7304 else
7305 {
7306 auto xp = CalculateXpToGive(this, tagger);
7307 if (xp > 0)
7308 {
7309 tagger->giveXp(xp, getGuid(), true);
7310 // Give XP to pets also
7311 if (tagger->getPet() != nullptr && tagger->getPet()->canGainXp())
7312 {
7313 xp = CalculateXpToGive(this, tagger->getPet());
7314 if (xp > 0)
7315 tagger->getPet()->giveXp(xp);
7316 }
7317 }
7318 }
7319
7320 if (isCreature())
7321 {
7322 sQuestMgr.OnPlayerKill(tagger, dynamic_cast<Creature*>(this), true);
7323
7324#ifdef FT_ACHIEVEMENTS
7325 if (tagger->isInGroup())
7326 {
7327 tagger->getGroup()->UpdateAchievementCriteriaForInrange(this, ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, getEntry(), 1, 0);
7328 tagger->getGroup()->UpdateAchievementCriteriaForInrange(this, ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE, getGuidHigh(), getGuidLow(), 0);
7329 }
7330 else
7331 {
7332 tagger->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, getEntry(), 1, 0);
7333 tagger->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE, getGuidHigh(), getGuidLow(), 0);
7334 }
7335#endif
7336 }
7337 }
7338 }
7339#ifdef FT_ACHIEVEMENTS
7340 else if (isCritter())
7341 {
7342 if (auto* const plrOwner = attacker->getPlayerOwnerOrSelf())
7343 {
7344 plrOwner->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, getEntry(), 1, 0);
7345 plrOwner->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE, getGuidHigh(), getGuidLow(), 0);
7346 }
7347 }
7348#endif
7349 }
7350
7351 // The unit has died so no need to proceed any further
7352 return;
7353 }
7354
7355 if (isPlayer())
7356 {
7357 const auto plr = dynamic_cast<Player*>(this);
7358 // todo: remove this hackfix...
7359 if (plr->m_cannibalize)
7360 {
7361 sEventMgr.RemoveEvents(plr, EVENT_CANNIBALIZE);
7363 plr->m_cannibalize = false;
7364 }
7365 }
7366
7367 // Modify health
7368 modHealth(-1 * static_cast<int32_t>(damage));
7369}
#define sHookInterface
@ TEAM_ALLIANCE
@ TEAM_HORDE
@ DUEL_WINNER_KNOCKOUT
@ PROC_ON_KILL
Definition ProcFlags.hpp:14
#define sQuestMgr
Definition QuestMgr.h:252
bool isGrayLevel(uint32_t attackerLevel, uint32_t victimLevel)
Definition Stats.cpp:42
@ EMOTE_ONESHOT_BEG
#define sWorld
Definition World.h:244
static void OnPlayerKilled(Player *pPlayer, Player *pVictim)
uint32_t getGuidHigh() const
Definition Object.cpp:307
uint32_t getGuidLow() const
Definition Object.cpp:304
void eventAttackStop()
Definition Player.cpp:13776
void endDuel(uint8_t condition)
Definition Player.cpp:11955
bool hasAuraState(AuraState state, SpellInfo const *spellInfo=nullptr, Unit const *caster=nullptr) const
Definition Unit.cpp:5130
virtual bool isPvpFlagSet() const
Definition Unit.cpp:6940
void modHealth(int32_t health)
Definition Unit.cpp:502
float m_damageTakenPctModOnHP35
Definition Unit.hpp:1377
virtual bool isCritter()
Definition Unit.hpp:1075
virtual void die(Unit *pAttacker, uint32_t damage, uint32_t spellid)
Definition Unit.cpp:374
bool isLootable()
Definition Unit.cpp:8174
virtual bool isTrainingDummy()
Definition Unit.hpp:1079
Here is the call graph for this function:
Here is the caller graph for this function:

◆ unitData()

const WoWUnit * Unit::unitData ( ) const
inlineprivate

Definition at line 171 of file Unit.hpp.

171{ return reinterpret_cast<WoWUnit*>(wow_data); }
WoWObject * wow_data
Definition Object.hpp:119

◆ unPossess()

void Unit::unPossess ( )

Definition at line 9007 of file Unit.cpp.

9008{
9009 Player* playerController;
9010 if (isPlayer())
9011 playerController = dynamic_cast<Player*>(this);
9012 else // creatures no support yet
9013 return;
9014
9015 if (!playerController)
9016 return;
9017
9018 if (!getCharmGuid())
9019 return;
9020
9021 Unit* unitTarget = getWorldMap()->getUnit(getCharmGuid());
9022 if (!unitTarget)
9023 return;
9024
9025 playerController->speedCheatReset();
9026
9027 if (unitTarget->isCreature())
9028 {
9029 unitTarget->setAItoUse(true);
9030 unitTarget->m_redirectSpellPackets = nullptr;
9031 unitTarget->m_playerControler = nullptr;
9032 }
9033
9034 m_noInterrupt--;
9035 playerController->setFarsightGuid(0);
9036 playerController->m_controledUnit = this;
9037
9038 setCharmGuid(0);
9039 unitTarget->setCharmedByGuid(0);
9040
9042
9044 unitTarget->setFaction(unitTarget->getCharmTempVal());
9045 unitTarget->updateInRangeOppositeFactionSet();
9046
9047 playerController->sendClientControlPacket(unitTarget, 0);
9048
9049 if (!(unitTarget->isPet() && dynamic_cast<Pet*>(unitTarget) == playerController->getPet()))
9050 playerController->sendEmptyPetSpellList();
9051
9052 setMoveRoot(false);
9053
9054 if (!unitTarget->isPet() && (unitTarget->getCreatedByGuid() == getGuid()))
9055 sEventMgr.AddEvent(static_cast<Object*>(unitTarget), &Object::Delete, 0, 1, 1, 0);
9056}
void speedCheatReset()
Definition Player.cpp:9374
void sendEmptyPetSpellList()
Definition Player.cpp:9767
uint32_t getCharmTempVal() const
Definition Unit.hpp:1483
Here is the call graph for this function:
Here is the caller graph for this function:

◆ unsetDetectRangeMod()

void Unit::unsetDetectRangeMod ( uint64_t  guid)

Definition at line 7614 of file Unit.cpp.

7615{
7616 for (uint8_t i = 0; i < 5; i++)
7617 {
7618 if (m_detectRangeGuids[i] == guid)
7619 {
7620 m_detectRangeGuids[i] = 0;
7621 m_detectRangeMods[i] = 0;
7622 }
7623 }
7624}
Here is the caller graph for this function:

◆ Update()

void Unit::Update ( unsigned long  time_passed)

Definition at line 157 of file Unit.cpp.

158{
159 const auto msTime = Util::getMSTime();
160
161 auto diff = msTime - m_lastSpellUpdateTime;
162 if (m_lastSpellUpdateTime == 0)
163 {
164 m_lastSpellUpdateTime = msTime;
165 }
166 else if (diff >= 100)
167 {
168 // Spells and auras are updated every 100ms
169 _UpdateSpells(diff);
170 _updateAuras(diff);
171
172 // Update spell school lockout timer
173 // TODO: Moved here from Spell::CanCast, figure out a better way to handle this... -Appled
174 for (uint8_t i = 0; i < TOTAL_SPELL_SCHOOLS; ++i)
175 {
176 if (m_schoolCastPrevent[i] == 0)
177 continue;
178
179 if (msTime >= m_schoolCastPrevent[i])
180 m_schoolCastPrevent[i] = 0;
181 }
182
184
185 m_lastSpellUpdateTime = msTime;
186 }
187
188 if (isAlive())
189 {
190 // Update health batch
191 if (time_passed >= m_healthBatchTime)
192 {
195 }
196 else
197 {
198 m_healthBatchTime -= static_cast<uint16_t>(time_passed);
199 }
200
201 // POWER & HP REGENERATION
202 regenerateHealthAndPowers(static_cast<uint16_t>(time_passed));
203
205 {
206 if (time_passed >= m_healthRegenerationInterruptTime)
208 else
210 }
211
212#if VERSION_STRING < Cata
213 if (m_powerRegenerationInterruptTime > 0)
214 {
215 if (time_passed >= m_powerRegenerationInterruptTime)
216 {
217 m_powerRegenerationInterruptTime = 0;
218
219#if VERSION_STRING > TBC
220 if (isPlayer())
221 setUnitFlags2(UNIT_FLAG2_ENABLE_POWER_REGEN);
222#endif
223 }
224 else
225 {
226 m_powerRegenerationInterruptTime -= time_passed;
227 }
228 }
229#endif
230
231 if (m_aiInterface != nullptr)
232 {
233 diff = msTime - m_lastAiInterfaceUpdateTime;
235 {
237 }
238 else if (diff >= 100)
239 {
240 m_aiInterface->update(diff);
242 }
243 }
244 getThreatManager().update(time_passed);
246
248 {
249 uint32_t count = 0;
250 for (uint32_t x = 0; x < DIMINISHING_GROUP_COUNT; ++x)
251 {
252 // diminishing return stuff
254 {
255 if (time_passed >= m_diminishTimer[x])
256 {
257 // resetting after 15 sec
258 m_diminishTimer[x] = 0;
259 m_diminishCount[x] = 0;
260 }
261 else
262 {
263 // reducing, still.
264 m_diminishTimer[x] -= static_cast<uint16_t>(time_passed);
265 ++count;
266 }
267 }
268 }
269 if (!count)
270 m_diminishActive = false;
271 }
272 }
273 else
274 {
275 // Small chance that aura states are readded after they have been cleared in ::Die
276 // so make sure they are removed when unit is dead
277 if (getAuraState() != 0)
278 setAuraState(0);
279
280 if (m_aiInterface != nullptr)
282 }
283
284 updateSplineMovement(time_passed);
285 getMovementManager()->update(time_passed);
286}
@ TOTAL_SPELL_SCHOOLS
Definition School.hpp:19
@ UNIT_FLAG2_ENABLE_POWER_REGEN
@ HEALTH_BATCH_INTERVAL
#define DIMINISHING_GROUP_COUNT
void updateCombat(uint32_t msTime)
void update(uint32_t diff)
void _UpdateSpells(uint32_t time)
Definition Object.cpp:1428
void update(uint32_t tdiff)
uint32_t m_lastSpellUpdateTime
Definition Unit.hpp:1105
uint32_t m_schoolCastPrevent[TOTAL_SPELL_SCHOOLS]
Definition Unit.hpp:1362
uint16_t m_healthBatchTime
Definition Unit.hpp:1103
void regenerateHealthAndPowers(uint16_t timePassed)
Definition Unit.cpp:6358
void _updateAuras(unsigned long diff)
Definition Unit.cpp:5834
void updateSplineMovement(uint32_t t_diff)
Definition Unit.cpp:3158
void _updateHealth()
Definition Unit.cpp:7663
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateAuraForGroup()

void Unit::updateAuraForGroup ( uint8_t  slot)

Definition at line 9396 of file Unit.cpp.

9397{
9398 if (slot >= 64)
9399 return;
9400
9401 if (isPlayer())
9402 {
9403 const auto player = dynamic_cast<Player*>(this);
9404 if (player->getGroup())
9405 {
9407 player->setAuraUpdateMaskForRaid(slot);
9408 }
9409 }
9410 else if (Player* owner = getPlayerOwner())
9411 {
9412 if (owner->getGroup())
9413 {
9414 owner->addGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_AURAS);
9416 }
9417 }
9418}
@ GROUP_UPDATE_FLAG_PET_AURAS
Definition Group.h:72
@ GROUP_UPDATE_FLAG_AURAS
Definition Group.h:63
void addGroupUpdateFlag(uint32_t flag)
Definition Player.cpp:7908
void setAuraUpdateMaskForRaid(uint8_t slot)
Definition Unit.hpp:1286
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateEnergyRegeneration()

void Unit::updateEnergyRegeneration ( bool  initialUpdate = false)

Definition at line 20 of file UnitStats.cpp.

21{
22#if VERSION_STRING >= TBC
23 // Patch 2.2.0: "Any effect which triggers a change in your rate of power regeneration (Mana, Rage, Energy, Focus)
24 // will now cause an immediate reward of some power at the old rate of increase, and then begin new "ticks" of power at the new rate approximately 2 seconds later.
25 // This was done to improve functionality of abilities such as Evocation and Innervate so that they did not have wasted "ticks"."
26 if (!initialUpdate && isAlive())
28#endif
29
30 // Base gain is 10 energy per second
31 float_t amount = 10.0f;
32 // Flat values are per 5 seconds
34 // Percentage mods
36 // Config rates
37 amount *= getConfigRateFor(this, RATE_POWER4);
38 // Remove base gain
39 amount -= 10.0f;
40
43}
@ SPELL_AURA_MOD_POWER_REGEN
static float_t getConfigRateFor(Unit const *unit, WorldConfigRates rate)
Definition UnitStats.cpp:12
@ RATE_POWER4
Definition WorldConfig.h:18
void setPowerRegenerationWhileInterrupted(PowerType type, float value)
Definition Unit.cpp:887
void setPowerRegeneration(PowerType type, float value)
Definition Unit.cpp:794
void _regeneratePowersAtRegenUpdate(PowerType type)
Definition Unit.cpp:6761
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateFocusRegeneration()

void Unit::updateFocusRegeneration ( bool  initialUpdate = false)

Definition at line 45 of file UnitStats.cpp.

46{
47#if VERSION_STRING >= TBC
48 // Patch 2.2.0: "Any effect which triggers a change in your rate of power regeneration (Mana, Rage, Energy, Focus)
49 // will now cause an immediate reward of some power at the old rate of increase, and then begin new "ticks" of power at the new rate approximately 2 seconds later.
50 // This was done to improve functionality of abilities such as Evocation and Innervate so that they did not have wasted "ticks"."
51 if (!initialUpdate && isAlive())
53#endif
54
55#if VERSION_STRING < WotLK
56 // Base gain is 6 focus per second
57 const float_t base = 6.0f;
58#else
59 // Base gain is 5 focus per second
60 const float_t base = 5.0f;
61#endif
62 auto amount = base;
63 // Flat values are per 5 seconds
65 // Percentage mods
67 // Config rates
68 amount *= getConfigRateFor(this, RATE_POWER3);
69 // Remove base gain
70 amount -= base;
71
74}
@ RATE_POWER3
Definition WorldConfig.h:17
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateSpeed()

void Unit::updateSpeed ( )

Definition at line 2954 of file Unit.cpp.

2955{
2956 if (getMountDisplayId() == 0)
2957 {
2958 setSpeedRate(TYPE_RUN, getSpeedRate(TYPE_RUN, false) * (1.0f + static_cast<float>(m_speedModifier) / 100.0f), true);
2959 }
2960 else
2961 {
2962 setSpeedRate(TYPE_RUN, getSpeedRate(TYPE_RUN, false) * (1.0f + static_cast<float>(m_mountedspeedModifier) / 100.0f), true);
2963 setSpeedRate(TYPE_RUN, getSpeedRate(TYPE_RUN, true) + (m_speedModifier < 0 ? (getSpeedRate(TYPE_RUN, false) * static_cast<float>(m_speedModifier) / 100.0f) : 0), true);
2964 }
2965
2966 setSpeedRate(TYPE_FLY, getSpeedRate(TYPE_FLY, false) * (1.0f + ((float)m_flyspeedModifier) / 100.0f), true);
2967
2968 // Limit speed due to effects such as http://www.wowhead.com/?spell=31896 [Judgement of Justice]
2970 {
2972 }
2973
2974 if (isPlayer() && dynamic_cast<Player*>(this)->m_changingMaps)
2975 {
2976 dynamic_cast<Player*>(this)->m_resendSpeed = true;
2977 }
2978 else
2979 {
2982 }
2983}
int32_t m_flyspeedModifier
Definition Unit.hpp:626
int32_t m_mountedspeedModifier
Definition Unit.hpp:625
void setSpeedRate(UnitSpeedType mtype, float rate, bool current)
Definition Unit.cpp:2668
float m_maxSpeed
Definition Unit.hpp:628
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateSplineMovement()

void Unit::updateSplineMovement ( uint32_t  t_diff)
private

Definition at line 3158 of file Unit.cpp.

3159{
3160 if (movespline->Finalized())
3161 return;
3162
3163 movespline->updateState(t_diff);
3164 bool arrived = movespline->Finalized();
3165
3166 if (movespline->isCyclic())
3167 {
3168 m_splineSyncTimer -= t_diff;
3169 if (m_splineSyncTimer <= 0)
3170 {
3171 m_splineSyncTimer = 5000; // Retail value, do not change
3172
3173 ByteBuffer packedGuid;
3174 packedGuid.appendPackGUID(getGuid());
3175
3176 WorldPacket data(SMSG_FLIGHT_SPLINE_SYNC, 4 + packedGuid.size());
3178 data.append(packedGuid);
3179 sendMessageToSet(&data, true);
3180 }
3181 }
3182
3183 if (arrived)
3184 {
3185 disableSpline();
3186#if VERSION_STRING >= WotLK
3187 if (movespline->HasAnimation())
3188 setAnimationFlags(movespline->GetAnimationTier());
3189#endif
3190 }
3191
3193}
@ SMSG_FLIGHT_SPLINE_SYNC
Definition Opcodes.hpp:986
void appendPackGUID(uint64_t guid)
Definition ByteBuffer.h:562
static void WriteSplineSync(MoveSpline const &mov, ByteBuffer &data)
int32_t m_splineSyncTimer
Definition Unit.hpp:678
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateSplinePosition()

void Unit::updateSplinePosition ( )
private

Definition at line 3195 of file Unit.cpp.

3196{
3197 MovementMgr::Location loc = movespline->ComputePosition();
3198
3199 if (movespline->onTransport)
3200 {
3202 pos.x = loc.x;
3203 pos.y = loc.y;
3204 pos.z = loc.z;
3206
3207#ifdef FT_VEHICLES
3208 if (TransportBase* vehicle = getVehicle())
3209 {
3210 vehicle->calculatePassengerPosition(loc.x, loc.y, loc.z, &loc.orientation);
3211 }
3212 else if (TransportBase* transport = GetTransport())
3213 {
3214 transport->calculatePassengerPosition(loc.x, loc.y, loc.z, &loc.orientation);
3215 }
3216 else
3217 {
3218 return;
3219 }
3220#else
3221 if (TransportBase* transport = GetTransport())
3222 {
3223 transport->calculatePassengerPosition(loc.x, loc.y, loc.z, &loc.orientation);
3224 }
3225 else
3226 {
3227 return;
3228 }
3229#endif
3230 }
3231
3234
3235 SetPosition(loc.x, loc.y, loc.z, loc.orientation);
3236}
float normalizeOrientation(float orientation)
float y
Definition Vector3.h:62
float x
Definition Vector3.h:62
float z
Definition Vector3.h:62
bool SetPosition(float newX, float newY, float newZ, float newOrientation, bool allowPorting=false)
Definition Object.cpp:3354
LocationVector transport_position
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateVisibility()

void Unit::updateVisibility ( )

Definition at line 6244 of file Unit.cpp.

6245{
6246 ByteBuffer buf(3000);
6248 bool canSee;
6249 bool isVisible;
6250
6251 if (isPlayer())
6252 {
6253 Player* player = dynamic_cast<Player*>(this);
6254 for (const auto& inRangeObject : getInRangeObjectsSet())
6255 {
6256 if (inRangeObject)
6257 {
6258 canSee = player->canSee(inRangeObject);
6259 isVisible = player->isVisibleObject(inRangeObject->getGuid());
6260 if (canSee)
6261 {
6262 if (!isVisible)
6263 {
6264 buf.clear();
6265 count = inRangeObject->buildCreateUpdateBlockForPlayer(&buf, player);
6266 player->getUpdateMgr().pushCreationData(&buf, count);
6267 player->addVisibleObject(inRangeObject->getGuid());
6268 }
6269 }
6270 else
6271 {
6272 if (isVisible)
6273 {
6274 player->sendDestroyObjectPacket(inRangeObject->getGuid());
6275 player->removeVisibleObject(inRangeObject->getGuid());
6276 }
6277 }
6278
6279 if (inRangeObject->isPlayer())
6280 {
6281 Player* inRangePlayer = dynamic_cast<Player*>(inRangeObject);
6282 canSee = inRangePlayer->canSee(player);
6283 isVisible = inRangePlayer->isVisibleObject(player->getGuid());
6284 if (canSee)
6285 {
6286 if (!isVisible)
6287 {
6288 buf.clear();
6289 count = player->buildCreateUpdateBlockForPlayer(&buf, inRangePlayer);
6290 inRangePlayer->getUpdateMgr().pushCreationData(&buf, count);
6291 inRangePlayer->addVisibleObject(player->getGuid());
6292 }
6293 }
6294 else
6295 {
6296 if (isVisible)
6297 {
6298 inRangePlayer->sendDestroyObjectPacket(player->getGuid());
6299 inRangePlayer->removeVisibleObject(player->getGuid());
6300 }
6301 }
6302 }
6303 else if (inRangeObject->isCreature() && player->getSession() && player->getSession()->HasGMPermissions())
6304 {
6305 auto* const inRangeCreature = dynamic_cast<Creature*>(inRangeObject);
6306
6307 uint32_t fieldIds[] =
6308 {
6309 // Update unit flags to remove not selectable flag
6311 // Placeholder if creature is a trigger npc
6312 0,
6313 0
6314 };
6315
6316 // Update trigger model
6317 if (inRangeCreature->GetCreatureProperties()->isTriggerNpc)
6318 fieldIds[1] = getOffsetForStructuredField(WoWUnit, display_id);
6319
6320 inRangeCreature->forceBuildUpdateValueForFields(fieldIds, player);
6321 }
6322 }
6323 }
6324 }
6325 else // For units we can save a lot of work
6326 {
6327 for (const auto& inRangeObject : getInRangePlayersSet())
6328 {
6329 if (Player* inRangePlayer = dynamic_cast<Player*>(inRangeObject))
6330 {
6331 canSee = inRangePlayer->canSee(this);
6332 isVisible = inRangePlayer->isVisibleObject(this->getGuid());
6333 if (!canSee)
6334 {
6335 if (isVisible)
6336 {
6337 inRangePlayer->sendDestroyObjectPacket(getGuid());
6338 inRangePlayer->removeVisibleObject(getGuid());
6339 }
6340 }
6341 else
6342 {
6343 if (!isVisible)
6344 {
6345 buf.clear();
6346 count = buildCreateUpdateBlockForPlayer(&buf, inRangePlayer);
6347 inRangePlayer->getUpdateMgr().pushCreationData(&buf, count);
6348 inRangePlayer->addVisibleObject(this->getGuid());
6349 }
6350 }
6351 }
6352 }
6353 }
6354}
#define getOffsetForStructuredField(s, m)
virtual uint32_t buildCreateUpdateBlockForPlayer(ByteBuffer *data, Player *target)
This includes any nested objects we have, inventory for example.
Definition Object.cpp:421
std::vector< Object * > getInRangePlayersSet() const
Definition Object.cpp:1617
void sendDestroyObjectPacket(uint64_t destroyedGuid)
Definition Player.cpp:9611
bool isVisibleObject(uint64_t guid)
Definition Player.cpp:3599
UpdateManager & getUpdateMgr()
Definition Player.cpp:3554
void addVisibleObject(uint64_t guid)
Definition Player.cpp:3587
uint32_t buildCreateUpdateBlockForPlayer(ByteBuffer *data, Player *target) override
This includes any nested objects we have, inventory for example.
Definition Player.cpp:3303
void removeVisibleObject(uint64_t guid)
Definition Player.cpp:3588
bool canSee(Object *const obj)
Definition Unit.cpp:5845
void pushCreationData(ByteBuffer *data, uint32_t updateCount)
bool HasGMPermissions() const
char buf[N_BUF]
Definition spewG.c:36
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wipeHateList()

void Unit::wipeHateList ( )

Definition at line 8090 of file Unit.cpp.

8091{
8093}
Here is the call graph for this function:

◆ wipeTargetList()

void Unit::wipeTargetList ( )

Definition at line 8095 of file Unit.cpp.

8096{
8098}
Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ AIInterface

friend class AIInterface
friend

Definition at line 1309 of file Unit.hpp.

◆ Aura

friend class Aura
friend

Definition at line 1310 of file Unit.hpp.

◆ ThreatManager

friend class ThreatManager
friend

Definition at line 1182 of file Unit.hpp.

Member Data Documentation

◆ i_movementManager

std::unique_ptr<MovementManager> Unit::i_movementManager
protected

Definition at line 668 of file Unit.hpp.

◆ loot

Loot Unit::loot

Definition at line 1221 of file Unit.hpp.

◆ m_aiInterface

std::unique_ptr<AIInterface> Unit::m_aiInterface
protected

Definition at line 700 of file Unit.hpp.

◆ m_amount

int32_t Unit::m_amount = 0

Definition at line 1506 of file Unit.hpp.

◆ m_AOEDmgMod

float Unit::m_AOEDmgMod = 1.0f

Definition at line 1428 of file Unit.hpp.

◆ m_ascBleed

int8_t Unit::m_ascBleed = 0

Definition at line 1477 of file Unit.hpp.

◆ m_ascEnraged

int8_t Unit::m_ascEnraged = 0

Definition at line 1475 of file Unit.hpp.

◆ m_ascFrozen

int8_t Unit::m_ascFrozen = 0

Definition at line 1474 of file Unit.hpp.

◆ m_ascSeal

int8_t Unit::m_ascSeal = 0

Definition at line 1476 of file Unit.hpp.

◆ m_attackerCritChanceMod

int32_t Unit::m_attackerCritChanceMod[TOTAL_SPELL_SCHOOLS] = {0}

Definition at line 1456 of file Unit.hpp.

1456{0};

◆ m_attackPowerModifier

int32_t Unit::m_attackPowerModifier = 0

Definition at line 1404 of file Unit.hpp.

◆ m_attackSpeed

float Unit::m_attackSpeed[TOTAL_WEAPON_DAMAGE_TYPES] = { 1.0f, 1.0f, 1.0f }
private

Definition at line 1095 of file Unit.hpp.

1095{ 1.0f, 1.0f, 1.0f };

◆ m_attackTimer

uint32_t Unit::m_attackTimer[TOTAL_WEAPON_DAMAGE_TYPES] = {0}
private

Definition at line 1093 of file Unit.hpp.

1093{0};

◆ m_auraEffectList

AuraEffectListArray Unit::m_auraEffectList
private

Definition at line 904 of file Unit.hpp.

◆ m_auraList

AuraArray Unit::m_auraList
private

Definition at line 903 of file Unit.hpp.

◆ m_auraRaidUpdateMask

uint64_t Unit::m_auraRaidUpdateMask = 0
protected

Definition at line 1289 of file Unit.hpp.

◆ m_auraVisualList

VisualAuraArray Unit::m_auraVisualList = { 0 }
private

Definition at line 905 of file Unit.hpp.

905{ 0 };

◆ m_baseDamage

float Unit::m_baseDamage[2] = {0}

Definition at line 1390 of file Unit.hpp.

1390{0};

◆ m_baseOffhandDamage

float Unit::m_baseOffhandDamage[2] = {0}

Definition at line 1394 of file Unit.hpp.

1394{0};

◆ m_baseRangedDamage

float Unit::m_baseRangedDamage[2] = {0}

Definition at line 1398 of file Unit.hpp.

1398{0};

◆ m_baseResistance

uint32_t Unit::m_baseResistance[TOTAL_SPELL_SCHOOLS] = {0}

Definition at line 1442 of file Unit.hpp.

1442{0}; // there are resistances for silence, fear, mechanics ....

◆ m_baseStats

uint32_t Unit::m_baseStats[5] = {0}

Definition at line 1443 of file Unit.hpp.

1443{0};

◆ m_blockFromSpell

float Unit::m_blockFromSpell = 0.0f
protected

Definition at line 1526 of file Unit.hpp.

◆ m_blockModPct

uint32_t Unit::m_blockModPct = 0
protected

Definition at line 1539 of file Unit.hpp.

◆ m_canDualWield

bool Unit::m_canDualWield = false
private

Definition at line 793 of file Unit.hpp.

◆ m_canMove

uint32_t Unit::m_canMove = 0

Definition at line 1328 of file Unit.hpp.

◆ m_canParry

bool Unit::m_canParry = false
protected

Definition at line 1437 of file Unit.hpp.

◆ m_combatHandler

CombatHandler Unit::m_combatHandler
private

Definition at line 561 of file Unit.hpp.

◆ m_CombatResult_Dodge

int32_t Unit::m_CombatResult_Dodge = 0

Definition at line 546 of file Unit.hpp.

◆ m_CombatResult_Parry

int32_t Unit::m_CombatResult_Parry = 0

Definition at line 547 of file Unit.hpp.

◆ m_controledUnit

Unit* Unit::m_controledUnit = this

Definition at line 694 of file Unit.hpp.

◆ m_creatureAttackPowerMod

int32_t Unit::m_creatureAttackPowerMod[12] = {0}

Definition at line 1459 of file Unit.hpp.

1459{0};

◆ m_creatureRangedAttackPowerMod

int32_t Unit::m_creatureRangedAttackPowerMod[12] = {0}

Definition at line 1460 of file Unit.hpp.

1460{0};

◆ m_critMeleeDamageTakenPctMod

float Unit::m_critMeleeDamageTakenPctMod[TOTAL_SPELL_SCHOOLS] = {0}

Definition at line 1380 of file Unit.hpp.

1380{0};

◆ m_critRangedDamageTakenPctMod

float Unit::m_critRangedDamageTakenPctMod[TOTAL_SPELL_SCHOOLS] = {0}

Definition at line 1383 of file Unit.hpp.

1383{0};

◆ m_damageShields

std::list<DamageProc> Unit::m_damageShields

Definition at line 1326 of file Unit.hpp.

◆ m_damageShieldsInUse

bool Unit::m_damageShieldsInUse = false

Definition at line 1325 of file Unit.hpp.

◆ m_damageSplitTarget

std::unique_ptr<DamageSplitTarget> Unit::m_damageSplitTarget

Definition at line 1277 of file Unit.hpp.

◆ m_damageTakenMod

int32_t Unit::m_damageTakenMod[TOTAL_SPELL_SCHOOLS] = {0}

Definition at line 1371 of file Unit.hpp.

1371{0};

◆ m_damageTakenPctMod

float Unit::m_damageTakenPctMod[TOTAL_SPELL_SCHOOLS] = {0}

Definition at line 1374 of file Unit.hpp.

1374{0};

◆ m_damageTakenPctModOnHP35

float Unit::m_damageTakenPctModOnHP35 = 1

Definition at line 1377 of file Unit.hpp.

◆ m_deathState

DeathState Unit::m_deathState = ALIVE
protected

Definition at line 1117 of file Unit.hpp.

◆ m_detectRangeGuids

uint64_t Unit::m_detectRangeGuids[5] = {0}

Definition at line 1480 of file Unit.hpp.

1480{0};

◆ m_detectRangeMods

int32_t Unit::m_detectRangeMods[5] = {0}

Definition at line 1481 of file Unit.hpp.

1481{0};

◆ m_diminishActive

bool Unit::m_diminishActive = false

Definition at line 1495 of file Unit.hpp.

◆ m_diminishAuraCount

uint8_t Unit::m_diminishAuraCount[DIMINISHING_GROUP_COUNT] = {0}

Definition at line 1493 of file Unit.hpp.

1493{0};

◆ m_diminishCount

uint16_t Unit::m_diminishCount[DIMINISHING_GROUP_COUNT] = {0}

Definition at line 1492 of file Unit.hpp.

1492{0};

◆ m_diminishTimer

uint16_t Unit::m_diminishTimer[DIMINISHING_GROUP_COUNT] = {0}

Definition at line 1494 of file Unit.hpp.

1494{0};

◆ m_dispels

uint32_t Unit::m_dispels[10] = {0}

Definition at line 1410 of file Unit.hpp.

1410{0};

◆ m_dodgeFromSpell

float Unit::m_dodgeFromSpell = 0.0f
protected

Definition at line 1527 of file Unit.hpp.

◆ m_DoTPctIncrease

int32_t Unit::m_DoTPctIncrease[TOTAL_SPELL_SCHOOLS] = {0}

Definition at line 1425 of file Unit.hpp.

1425{0};

◆ m_dynamicObject

DynamicObject* Unit::m_dynamicObject = nullptr

Definition at line 1497 of file Unit.hpp.

◆ m_extraAttackCounter

bool Unit::m_extraAttackCounter = false
protected

Definition at line 1318 of file Unit.hpp.

◆ m_extraAttacks

int32_t Unit::m_extraAttacks = 0

Definition at line 1466 of file Unit.hpp.

◆ m_extraStrikeTarget

bool Unit::m_extraStrikeTarget = false

Definition at line 1467 of file Unit.hpp.

◆ m_extraStrikeTargetC

int32_t Unit::m_extraStrikeTargetC = 0

Definition at line 1468 of file Unit.hpp.

◆ m_extraStrikeTargets

std::list<std::unique_ptr<ExtraStrike> > Unit::m_extraStrikeTargets

Definition at line 1469 of file Unit.hpp.

◆ m_fearModifiers

int32_t Unit::m_fearModifiers = 0

Definition at line 1355 of file Unit.hpp.

◆ m_flyspeedModifier

int32_t Unit::m_flyspeedModifier = 0
private

Definition at line 626 of file Unit.hpp.

◆ m_followingMe

std::unordered_set<AbstractFollower*> Unit::m_followingMe
private

Definition at line 665 of file Unit.hpp.

◆ m_forced_speed_changes

uint8_t Unit::m_forced_speed_changes[MAX_SPEED_TYPE] = { 0 }

Definition at line 633 of file Unit.hpp.

633{ 0 };

◆ m_gameObj

GameObjectList Unit::m_gameObj
protected

Definition at line 1111 of file Unit.hpp.

◆ m_GarbageAuras

std::list<std::unique_ptr<Aura> > Unit::m_GarbageAuras
protected

Definition at line 1243 of file Unit.hpp.

◆ m_GarbagePets

std::list<Pet*> Unit::m_GarbagePets
protected

Definition at line 1244 of file Unit.hpp.

◆ m_generatedThreatModifyer

int32_t Unit::m_generatedThreatModifyer[TOTAL_SPELL_SCHOOLS] = { 0 }
private

Definition at line 1187 of file Unit.hpp.

1187{ 0 };

◆ m_healDoneMod

int32_t Unit::m_healDoneMod[TOTAL_SPELL_SCHOOLS] = {0}

Definition at line 1445 of file Unit.hpp.

1445{0};

◆ m_healDonePctMod

float Unit::m_healDonePctMod[TOTAL_SPELL_SCHOOLS] = {0}

Definition at line 1446 of file Unit.hpp.

1446{0};

◆ m_healTakenMod

int32_t Unit::m_healTakenMod[TOTAL_SPELL_SCHOOLS] = {0}

Definition at line 1448 of file Unit.hpp.

1448{0};

◆ m_healTakenPctMod

float Unit::m_healTakenPctMod[TOTAL_SPELL_SCHOOLS] = {0}

Definition at line 1449 of file Unit.hpp.

1449{0};

◆ m_healthBatch

std::vector<std::unique_ptr<HealthBatchEvent> > Unit::m_healthBatch
private

Definition at line 1102 of file Unit.hpp.

◆ m_healthBatchTime

uint16_t Unit::m_healthBatchTime = HEALTH_BATCH_INTERVAL
private

Definition at line 1103 of file Unit.hpp.

◆ m_healthRegenerateTimer

uint16_t Unit::m_healthRegenerateTimer = 0
protected

Definition at line 973 of file Unit.hpp.

◆ m_healthRegenerationInterruptTime

uint32_t Unit::m_healthRegenerationInterruptTime = 0
private

Definition at line 963 of file Unit.hpp.

◆ m_hitFromMeleeSpell

float Unit::m_hitFromMeleeSpell = 0.0f

Definition at line 1344 of file Unit.hpp.

◆ m_ignoreArmorPct

float Unit::m_ignoreArmorPct = 0.0f

Definition at line 1432 of file Unit.hpp.

◆ m_ignoreArmorPctMaceSpec

float Unit::m_ignoreArmorPctMaceSpec = 0.0f

Definition at line 1431 of file Unit.hpp.

◆ m_interruptRegen

int32_t Unit::m_interruptRegen = 0

Definition at line 1463 of file Unit.hpp.

◆ m_invisibilityDetection

int32_t Unit::m_invisibilityDetection[INVIS_FLAG_TOTAL] = {0}
private

Definition at line 936 of file Unit.hpp.

936{0};

◆ m_invisibilityLevel

int32_t Unit::m_invisibilityLevel[INVIS_FLAG_TOTAL] = {0}
private

Definition at line 935 of file Unit.hpp.

935{0};

◆ m_isDisarmed

bool Unit::m_isDisarmed = false

Definition at line 1479 of file Unit.hpp.

◆ m_isInvincible

bool Unit::m_isInvincible = false

Definition at line 1500 of file Unit.hpp.

◆ m_isProcInUse

bool Unit::m_isProcInUse = false

Definition at line 1499 of file Unit.hpp.

◆ m_lastAiInterfaceUpdateTime

uint32_t Unit::m_lastAiInterfaceUpdateTime = 0
protected

Definition at line 702 of file Unit.hpp.

◆ m_lastSpellUpdateTime

uint32_t Unit::m_lastSpellUpdateTime = 0
private

Definition at line 1105 of file Unit.hpp.

◆ m_magnetCasterGuid

int64_t Unit::m_magnetCasterGuid = 0

Definition at line 1471 of file Unit.hpp.

◆ m_manashieldAmount

int32_t Unit::m_manashieldAmount = 0
protected

Definition at line 1531 of file Unit.hpp.

◆ m_manaShieldId

uint32_t Unit::m_manaShieldId = 0
protected

Definition at line 1532 of file Unit.hpp.

◆ m_max

int32_t Unit::m_max = 0

Definition at line 1507 of file Unit.hpp.

◆ m_maxSpeed

float Unit::m_maxSpeed = 0
private

Definition at line 628 of file Unit.hpp.

◆ m_mechanicDurationPctMod

int32_t Unit::m_mechanicDurationPctMod[28] = {0}

Definition at line 1365 of file Unit.hpp.

1365{0};

◆ m_mechanicsDispels

uint32_t Unit::m_mechanicsDispels[32] = {0}

Definition at line 1416 of file Unit.hpp.

1416{0};

◆ m_mechanicsResistancesPct

float Unit::m_mechanicsResistancesPct[32] = {0}

Definition at line 1419 of file Unit.hpp.

1419{0};

◆ m_meleeSpell

uint32_t Unit::m_meleeSpell = 0
protected

Definition at line 1338 of file Unit.hpp.

◆ m_meleeSpell_ecn

uint8_t Unit::m_meleeSpell_ecn = 0
protected

Definition at line 1339 of file Unit.hpp.

◆ m_modDamageTakenByMechPct

float Unit::m_modDamageTakenByMechPct[32] = {0}

Definition at line 1422 of file Unit.hpp.

1422{0};

◆ m_modelHalfSize

float Unit::m_modelHalfSize = 1.0f
protected

Definition at line 1513 of file Unit.hpp.

◆ m_modlanguage

int32_t Unit::m_modlanguage = -1

Definition at line 1002 of file Unit.hpp.

◆ m_mountedspeedModifier

int32_t Unit::m_mountedspeedModifier = 0
private

Definition at line 625 of file Unit.hpp.

◆ m_noFallDamage

bool Unit::m_noFallDamage = false

Definition at line 614 of file Unit.hpp.

◆ m_noInterrupt

uint16_t Unit::m_noInterrupt = 0

Definition at line 1236 of file Unit.hpp.

◆ m_objectSlots

uint32_t Unit::m_objectSlots[4] = { 0 }

Definition at line 1086 of file Unit.hpp.

1086{ 0 };

◆ m_oldEmote

uint32_t Unit::m_oldEmote = 0
private

Definition at line 1107 of file Unit.hpp.

◆ m_pacified

int32_t Unit::m_pacified = 0

Definition at line 1349 of file Unit.hpp.

◆ m_parryFromSpell

float Unit::m_parryFromSpell = 0.0f
protected

Definition at line 1528 of file Unit.hpp.

◆ m_playerControler

Player* Unit::m_playerControler = nullptr

Definition at line 695 of file Unit.hpp.

◆ m_powerCostPctMod

float Unit::m_powerCostPctMod[TOTAL_SPELL_SCHOOLS] = {0}

Definition at line 1454 of file Unit.hpp.

1454{0}; // armor penetration & spell penetration

◆ m_powerFractions

float_t Unit::m_powerFractions[TOTAL_PLAYER_POWER_TYPES] = {0}
private

Definition at line 970 of file Unit.hpp.

970{0};

◆ m_powerRegenerateTimer

uint16_t Unit::m_powerRegenerateTimer = 0
protected

Definition at line 988 of file Unit.hpp.

◆ m_powerRegenPct

int32_t Unit::m_powerRegenPct = 0

Definition at line 1464 of file Unit.hpp.

◆ m_powerUpdatePacketTime

uint16_t Unit::m_powerUpdatePacketTime = 0
protected

Definition at line 989 of file Unit.hpp.

◆ m_procSpells

std::list<std::unique_ptr<SpellProc> > Unit::m_procSpells
private

Definition at line 795 of file Unit.hpp.

◆ m_rangeAttackPowerModifier

int32_t Unit::m_rangeAttackPowerModifier = 0

Definition at line 1401 of file Unit.hpp.

◆ m_rangedDamageTaken

int32_t Unit::m_rangedDamageTaken = 0

Definition at line 1386 of file Unit.hpp.

◆ m_redirectSpellPackets

Player* Unit::m_redirectSpellPackets = nullptr

Definition at line 1502 of file Unit.hpp.

◆ m_reflectSpellSchool

std::list<std::unique_ptr<ReflectSpellSchool> > Unit::m_reflectSpellSchool

Definition at line 1280 of file Unit.hpp.

◆ m_resistChance

int32_t Unit::m_resistChance = 0

Definition at line 1359 of file Unit.hpp.

◆ m_rootCounter

int32_t Unit::m_rootCounter = 0
private

Definition at line 592 of file Unit.hpp.

◆ m_safeFall

int32_t Unit::m_safeFall = 0

Definition at line 613 of file Unit.hpp.

◆ m_schoolCastPrevent

uint32_t Unit::m_schoolCastPrevent[TOTAL_SPELL_SCHOOLS] = {0}

Definition at line 1362 of file Unit.hpp.

1362{0};

◆ m_schoolImmunityList

uint32_t Unit::m_schoolImmunityList[TOTAL_SPELL_SCHOOLS] = {0}

Definition at line 1451 of file Unit.hpp.

1451{0};

◆ m_silenced

int32_t Unit::m_silenced = 0

Definition at line 790 of file Unit.hpp.

◆ m_singleTargetAura

UniqueAuraTargetMap Unit::m_singleTargetAura
protected

Definition at line 1536 of file Unit.hpp.

◆ m_slowdown

int32_t Unit::m_slowdown = 0
private

Definition at line 627 of file Unit.hpp.

◆ [struct]

struct { ... } Unit::m_soulSiphon

◆ m_speedModifier

int32_t Unit::m_speedModifier = 0
private

Definition at line 624 of file Unit.hpp.

◆ m_spellCritChanceSchool

float Unit::m_spellCritChanceSchool[TOTAL_SPELL_SCHOOLS] = {0}

Definition at line 1452 of file Unit.hpp.

1452{0};

◆ m_spellCritPercentage

float Unit::m_spellCritPercentage = 0.0f

Definition at line 769 of file Unit.hpp.

◆ m_spellDelayResist

uint32_t Unit::m_spellDelayResist[TOTAL_SPELL_SCHOOLS] = {0}

Definition at line 1457 of file Unit.hpp.

1457{0};

◆ m_spellImmunityMask

uint32_t Unit::m_spellImmunityMask = SPELL_IMMUNITY_NONE
private

Definition at line 799 of file Unit.hpp.

◆ m_spellModifiers

std::list<AuraEffectModifier const*> Unit::m_spellModifiers[MAX_SPELLMOD_TYPE]
private

Definition at line 797 of file Unit.hpp.

◆ m_splineSyncTimer

int32_t Unit::m_splineSyncTimer = 5000
private

Definition at line 678 of file Unit.hpp.

◆ m_stalkedByGuid

uint64_t Unit::m_stalkedByGuid = 0

Definition at line 1407 of file Unit.hpp.

◆ m_stealthDetection

int32_t Unit::m_stealthDetection[STEALTH_FLAG_TOTAL] = {0}
private

Definition at line 933 of file Unit.hpp.

933{0};

◆ m_stealthLevel

int32_t Unit::m_stealthLevel[STEALTH_FLAG_TOTAL] = {0}
private

Definition at line 932 of file Unit.hpp.

932{0};

◆ m_stunned

int32_t Unit::m_stunned = 0

Definition at line 1352 of file Unit.hpp.

◆ m_summonInterface

std::unique_ptr<SummonHandler> Unit::m_summonInterface
private

Definition at line 1137 of file Unit.hpp.

◆ m_taggedBySummon

bool Unit::m_taggedBySummon = false
private

Definition at line 1208 of file Unit.hpp.

◆ m_taggerGuid

uint64_t Unit::m_taggerGuid = 0
private

Definition at line 1207 of file Unit.hpp.

◆ m_tempAuraMap

std::map<uint32_t, Aura*> Unit::m_tempAuraMap

Definition at line 1440 of file Unit.hpp.

◆ m_tempCharm

uint32_t Unit::m_tempCharm = 0
protected

Definition at line 1487 of file Unit.hpp.

◆ m_threatManager

ThreatManager Unit::m_threatManager = this
private

Definition at line 1183 of file Unit.hpp.

◆ m_threatModifyer

int32_t Unit::m_threatModifyer = 0
private

Definition at line 1186 of file Unit.hpp.

◆ m_trackStealth

bool Unit::m_trackStealth = false

Definition at line 1413 of file Unit.hpp.

◆ m_transformAura

uint32_t Unit::m_transformAura = 0
private

Definition at line 901 of file Unit.hpp.

◆ m_triggerOnChill

uint32_t Unit::m_triggerOnChill = 0

Definition at line 1265 of file Unit.hpp.

◆ m_triggerOnChillChance

uint32_t Unit::m_triggerOnChillChance = 100

Definition at line 1266 of file Unit.hpp.

◆ m_triggerOnChillChanceVictim

uint32_t Unit::m_triggerOnChillChanceVictim = 100

Definition at line 1268 of file Unit.hpp.

◆ m_triggerOnChillVictim

uint32_t Unit::m_triggerOnChillVictim = 0

Definition at line 1267 of file Unit.hpp.

◆ m_triggerOnStun

uint32_t Unit::m_triggerOnStun = 0

Definition at line 1256 of file Unit.hpp.

◆ m_triggerOnStunChance

uint32_t Unit::m_triggerOnStunChance = 100

Definition at line 1257 of file Unit.hpp.

◆ m_triggerOnStunChanceVictim

uint32_t Unit::m_triggerOnStunChanceVictim = 100

Definition at line 1259 of file Unit.hpp.

◆ m_triggerOnStunVictim

uint32_t Unit::m_triggerOnStunVictim = 0

Definition at line 1258 of file Unit.hpp.

◆ m_UnitSpeedInfo

UnitSpeedInfo Unit::m_UnitSpeedInfo
private

Definition at line 621 of file Unit.hpp.

◆ m_unitState

uint32_t Unit::m_unitState = 0
private

Definition at line 713 of file Unit.hpp.

◆ m_useAI

bool Unit::m_useAI = false
protected

Definition at line 701 of file Unit.hpp.

◆ m_zAxisPosition

float Unit::m_zAxisPosition = 0.0f

Definition at line 612 of file Unit.hpp.

◆ movespline

std::unique_ptr<MovementMgr::MoveSpline> Unit::movespline

Definition at line 648 of file Unit.hpp.

◆ speedReductionMap

std::map<uint32_t, int32_t> Unit::speedReductionMap
private

Definition at line 630 of file Unit.hpp.


The documentation for this class was generated from the following files: